What prompts this question is today's anniversary of the famous surprise attack on the Russian fleet at Port Arthur in 1904, which famously foreshadowed the bigger surprise attack at Pearl Harbor in 1941.
The Port Arthur attack was not the first time the Japanese has started a war that way, they had also started their 1894 war with China without a formal declaration of war.
The value of surprise in battle is well-established, of course, and it's a desirable state to achieve, although not uniquely so. It's just one factor that can give advantage, right along with superior quality training and equipment, numbers, etc.
But a surprise attack that starts a war brings additional costs into consideration. Before the modern era of warfare it was very hard to pull off a strategically significant "sneak attack." In the last 200 years or so, concerns about "out-of-the-blue" surprise attacks have grown, especially in the context of nuclear weapons.
But overall I think the track record for "sneak attacks" is rather poor. At Pearl Harbor, of course, the Japanese did a lot of damage, but it's generally considered to be a grand strategic blunder than ensured Japan would lose the war.
The outcome for Japan in the 1904-05 war was positive, but it's hard to give much credit to the sneak Japanese torpedo boat attack that started the conflict. Only three major Russian ships were damaged, none fatally. The Russian inaction in the face of the Japanese fleet was a failure of leadership, not material -- as demonstrated when Admiral Markoff arrived on the scene.
When used in a carefully targeted way, in ways that keep the conflict strictly limited, a surprise strike may work out well. But a misjudgment on this score is very dangerous, and if the war fails to stay limited, a surprise attack may cost more than it gains.