June 1942. Corporal John Bramble (Franchot Tone) is the sole survivor of a British tank crew after a major battle with Erwin Rommel's victorious Afrika Korps at the Battle of Gazala. Delirious, he stumbles across the North African desert into the Empress of Britain, a small, isolated hotel owned by Farid (Akim Tamiroff). The staff consists of just Frenchwoman Mouche (Anne Baxter), as the cook has fled and the waiter Davos was killed the night before by German bombing.
Before Farid and Mouche can decide what to do with the newcomer, the swiftly advancing Germans take over the hotel to use as headquarters for Field Marshal Rommel (Erich von Stroheim) and his staff. Bramble assumes the identity of Davos to save himself. When Rommel summons him to a private chat, Bramble is stunned to discover that Davos was a valued German spy, but manages to play along. He learns that he is to be sent to Cairo next.
Later, he steals a pistol from genial, music-loving Italian General Sebastiano (Fortunio Bonanova), planning to serve the field marshal a bullet rather than coffee the next morning. Not wanting trouble, Mouche steals the pistol and waits on Rommel herself. When some captured British officers are brought to the hotel for a luncheon with Rommel, one of them (a past guest) realizes that Davos has been replaced. Bramble privately explains who he is and what he plans to do. The officer orders him to use his position of trust to instead gather military intelligence.
At the luncheon, Rommel teases his guests, allowing them to ask him twenty questions about his future plans. Bramble listens with interest. From the conversation and later remarks by Rommel, he eventually deduces that the field marshal, disguised as an archeologist before the war, had secretly prepared five hidden supply dumps, the "Five Graves to Cairo", for the conquest of Egypt. The final piece of the puzzle (their locations) falls into place when Bramble realizes that Rommel's cryptic references to points Y, P, and T refer to the letters of the word "Egypt" printed on his map.
Meanwhile, Bramble and Mouche clash. She despises the British for abandoning the French at Dunkirk. He in turn is disgusted at how she is playing up to the Germans. As it turns out, Mouche's motives are not mercenary; she pleads with Rommel to release her wounded soldier brother from a concentration camp. He is unmoved, but his aide, Lieutenant Schwegler (Peter van Eyck), is more appreciative of her charms. He pretends to help her, showing her fake telegrams to and from Germany.
That night however, when everyone takes shelter in the cellar during an Allied air raid, Schwegler discovers the body of the real Davos (easily identifiable by his clubfoot), uncovered by the bombing. In the noise and confusion of the raid, Bramble and Schwegler play a deadly game of hide and seek in the darkened hotel before Bramble kills his foe. He hides the body in Mouche's part of the servants' room. When Mouche finds out, she threatens to unmask him, despite his appeal to her patriotism.
However, she has a change of heart. Schwegler's body is soon found, and Rommel accuses her of killing his aide when she discovered he was lying about his assistance. Mouche does not deny it. Bramble leaves for Cairo, but arranges for Farid to present faked evidence the next day that Bramble committed the crime.
Bramble's information allows the British to blow up the dumps and thus thwart Rommel's plans, culminating in the Second Battle of El Alamein. When Bramble returns in triumph with his unit to the hotel, he is devastated to learn that the Germans had executed Mouche, not for murder, but because she would not stop saying that the British would be back. He takes the parasol he had bought for her, something she had always wanted, and uses it to provide shade for her grave.