U.S. benchmark oil gained US$1.64 to $101.24 a barrel in New York, its highest close since May 3, 2012.
Brent crude, which is used to price oil used by many U.S. refineries to make gasoline, rose $1.76 to finish at $105.76 in London.
Two events propelled the price of oil above $100 a barrel for the first time since the middle of September: unrest in Egypt and a big drop in U.S. oil supplies.
Traders were worried that political upheaval in Egypt could slow the flow of oil from the Middle East to world markets. Embattled Egyptian President Mohammed Morsi vowed not to give in to protesters' demands for his resignation. But the head of Egypt's military announced late Wednesday night local time that Morsi will be replaced and new elections will be held.
Egypt is not an oil producer but it control of one of the world's busiest shipping lanes gives it a crucial role in maintaining global energy supplies. The Middle East accounts for about a quarter of the world's crude oil output, or 23 million barrels per day. About two million barrels of that, or 2.2 per cent of world demand, are transported daily through the Suez Canal, which links the Mediterranean with the Red Sea.
Much of that oil is headed to Europe, but a supply drop anywhere in the world leads to higher prices everywhere.
"Markets tend to advance sharply on uncertainty and will often price in a worst case scenario. This appears to be the case with the unfolding situation in Egypt," wrote Jim Ritterbusch, president of energy consultancy Ritterbusch and Associates, in a note to clients.
Some analysts suggested market reaction to the political crisis in Egypt was exaggerated.
"If there is one thing that the military has control of in Egypt it is the Suez Canal. We therefore do not see a significant risk for free passage on the waterway," said Olivier Jakob of Petromatrix in Switzerland.
In the U.S., the Energy Department reported Wednesday that crude supplies fell by 10.3 million barrels from the previous week, more than three times the drop that analysts had expected.
The drop was likely the result of reduced supplies from Canada because of a temporary pipeline shutdown there, as well as increased demand from a BP refinery that restarted in Indiana.
Gasoline supplies fell as well, while analysts expected an increase. The drop in oil and gas supplies could be an indication that U.S. demand is rising.
The rising price of oil could end what has been a streak of 21 days of lower U.S. retail gasoline prices. The average U.S. pump price fell less than a penny Wednesday to $3.48 per gallon (91 cents a litre).
Analysts do not think the spike in oil prices will lead to sharply higher gasoline prices, though, because U.S. crude supplies remain high and refineries are turning out plenty of gasoline.
U.S. commodities markets are closed Thursday for the July Fourth holiday.
In other energy futures trading on the New York Mercantile Exchange:
— Wholesale gasoline rose six cents to end at $2.84 per gallon.
— Heating oil was up five cents to finish at $2.95 per gallon.
— Natural gas rose four cents to end at $3.69 per 1,000 cubic feet.
AP writer Pablo Gorondi in Budapest contributed to this report. Follow Jonathan Fahey on Twitter at http://twitter.com/JonathanFahey .
(TSX:ECA, TSX:IMO, TSX:SU, TSX:HSE, NYSE:BP, NYSE:COP, NYSE:XOM, NYSE:CVX, TSX:CNQ, TSX:TLM, TSX:COS.UN, TSX:CVE)