The Battle of Midway took place during 4 and 7 July 1942, between the United States Navy and an Imperial Japanese Navy (IJN). In the battle the USA defeated the Japanese decisively.
The Japanese attacked against Midway Atoll, in an operation which sought to eliminate the United States as a strategic power in the Pacific- an aim similar to the attacks on Pearl Harbor (which took place 6 months prior).
The attack was meant to take the US by surprise and demoralize them, forcing the United States to captulate in the Pacific War. Thus ensuring Japanese dominance in the Pacific.
Codebreakers were vital for America, as they were able to determine the date and location of the attack- this enabled US Navy to set up an ambush of their own.
In the battle, four Japanese aircraft carriers and a heavy cruiser were sunk at the cost of one American aircraft carrier and a destroyer.
War historian John Keegan called it "the most stunning and decisive blow in the history if naval warfare".