The government has blamed European Union sanctions on Russia for the end of the measure.
Hungary has abolished a cap on fuel prices after a recent wave of panic-buying and long queues at petrol stations.
The state-imposed cap of 480 forints (€1.17) per litre was cancelled with immediate effect on Tuesday, government minister Gergely Gulyas announced.
Prices will now be set according to the market rates of 640 forints (€1.56) per litre of petrol and 699 forints (€1.70) per litre of diesel, he told a news conference.
Hungary's government imposed the fuel price cap in November 2021 to curb price rises, but state energy company MOL has since struggled to keep up with demand, resulting in some shortages.
Fuel consumption in Hungary has risen around 25% since last year, on top of maintenance issues at one of MOL's oil refineries. Foreign companies also cut fuel shipments to Hungary after the cap was introduced
Earlier, MOL released a statement saying it had reached the end of its logistical capacities amid a "clearly critical supply situation".
Consumers rushed to petrol stations on Tuesday amid rumours of pumps running dry.
MOL chief Zsolt Hernadi said the queues at petrol stations were the longest since shortages during Hungary’s Soviet-dominated socialist period in the 1970s.
But Gulyas blamed the end of the price cap on European Union sanctions on Russia over its invasion of Ukraine.
“The government maintained the price cap as long as it could,” he said. The price cap had been due to expire on December 31.
Gulyas also acknowledged that the lifting of the price cap on fuel is likely to increase inflation in Hungary, which at 21.1% is the highest since 1996 and the third-highest in the EU
Budapest is still deciding whether to continue a price cap on basic food items in 2023, amid shortages of sugar, flour, and other products.