Battle of Midway
Having broken Japan’s codes, the US Navy ambushed the Japanese fleet bound for Midway and sank four carriers, turning the tide of the Pacific War.

Scouting Squadron 8 (VS-8), U.S. Navy; The original uploader was Palm dogg at English Wikipedia ., 2006-01-30 (first version); 2006-02-14 (last version) · Public domain · Source
In the six months after Pearl Harbor Japan swept across Southeast Asia and the western Pacific. Yamamoto Isoroku planned to attack Midway to draw out and destroy the remaining American carriers, but US codebreakers learned of the plan and laid an ambush.
On 4 June American dive-bombers set three Japanese carriers ablaze within minutes as they were rearming, and the fourth was sunk later that day. Having lost carriers and experienced pilots, Japan was on the defensive in the Pacific from then on.