The Second Battle of El Alamein (23 October – 11 November 1942) was a battle of the Second World War that took place near the Egyptian railway halt of El Alamein. With the Allies victorious, it was the watershed of the Western Desert Campaign. The First Battle of El Alamein had prevented the Axis from advancing further into Egypt. In August 1942, Lieutenant-General Sir Bernard Law Montgomery took command of the Eighth Army following the sacking of General Claude Auchinleck and the death of his replacement Lieutenant-General William Gott in an air crash.
The Allied victory turned the tide in the North African Campaign and ended the Axis threat to Egypt, the Suez Canal and the Middle Eastern and Persian oil fields via North Africa. The Second Battle of El Alamein revived the morale of the Allies, being the first big success against the Axis since Operation Crusader in late 1941. The battle coincided with the Allied invasion of French North Africa in Operation Torch, which started on 8 November, the Battle of Stalingrad and the Guadalcanal Campaign.
The Panzer Army Africa (Panzerarmee Afrika), composed of German and Italian infantry and mechanised units under Generalfeldmarschall Erwin Rommel, had struck deep into Egypt by 12 July 1942 after its success at the Battle of Gazala. This threatened the British Empire's control of the Suez Canal and Mandatory Palestine. General Claude Auchinleck withdrew the Eighth Army to within 80 kilometres (50 mi) of Alexandria to a point where the Qattara Depression came to within 64 kilometres (40 mi) of El Alamein on the coast. This gave the defenders a short front to defend and provided secure flanks because tanks could not traverse the Depression. The Axis advance was halted here in early July in the First Battle of El Alamein.
The Eighth Army counter-offensives during July failed, as Rommel had dug in to allow his exhausted troops to regroup. Auchinleck called off all offensive action at the end of July to allow rebuilding the Eighth Army's strength. In early August, the British Prime Minister, Winston Churchill, and General Sir Alan Brooke—the Chief of the Imperial General Staff (CIGS)—visited Cairo and replaced Auchinleck as Commander-in-chief (C-in-C) Middle East Command with General Sir Harold Alexander. Lieutenant-General William Gott was appointed to command of the Eighth Army, but he was killed when the transport plane he was travelling in was shot down by Luftwaffe fighters; Lieutenant-General Bernard Montgomery was then appointed commander of the Eighth Army.