Other precious metals finished strongly, with palladium up nearly 10% on the year, silver up 9% and platinum up 8%
Gold jumped on the last trading day of 2012 to finish up 6% on the year on news of a possible US fiscal deal, which lifted a market that had rallied earlier in the year on low interest rates, euro zone worries and central bank demand for bullion.
Other precious metals finished strongly, with palladium up nearly 10% on the year, silver up 9% and platinum up 8%.
It was the 12th straight year of gains for gold, making it one of the longest bull runs ever in a commodity. Oil, in contrast, has only been up for a fourth year since its rebound from the 2008 financial crisis.
Analysts expect bullion -- which started 2012 at below $1,580 and scaled nearly $1,800 by October after the US Federal Reserve rolled out a fresh economic stimulus -- to chart newer peaks in 2013. The market's all-time high above $1,930 was set in September 2011.
"If anything, gold's rally today with the removal of the US fiscal cliff proves that it's become a risk asset more than a safe haven," said Adam Sarhan at Sarhan Capital in New York.
Traditionally an inflation hedge and a market that investors rush to in times of trouble, gold has lately behaved more like an industrial commodity - rising and falling with the stock market and sometimes even following the dollar.
Worries about the so-called fiscal cliff had weighed on markets for weeks as the White House and its rival Republicans in Congress sought to find ways to avert some $600 billion in tax hikes and spending cuts that could have sent the economy into another recession in 2013.
Obama cautioned at a news conference that a deal was imminent but not yet in hand.
"Today it appears that an agreement to prevent this New Year's tax hike is within sight, but it is not done," the president said. "There are still issues left to resolve, but we're hopeful that Congress can get it done, but it's not done."
Gold futures' most-active contract settled at $1,675.80 an ounce, up 1.2% for the session and 6.1% on the year. Until news of the fiscal deal emerged, the market had barely gained half a percent.
The spot price of bullion hovered above $1,670 an ounce, up 1% on the day and up nearly 7% for 2012.
Although they moderated towards the year end, gold prices were up sharply in the first and third quarters, aided by ultra-loose monetary policy in the world's leading economies, bullion buying by central banks trying to diversify foreign reserves and concerns over the financial stability of the euro zone.
The rally in those quarters gave gold almost all of its 6% annual gain, ensuring its unbroken run since 2001.
Platinum, palladium and silver -- also counted as precious metals along with gold -- outperformed bullion for the year.
Palladium has been on a bullish trend since November when refiner Johnson Matthey projected the biggest supply deficit in 11 years in the metal largely used in auto exhaust systems.
The spot price of palladium hovered near $700 an ounce, up more than 7% for the year.
Platinum has turned volatile after rallying earlier in the year on concerns about sprawling worker strikes in top producer South Africa.
US platinum's front-month contract fell to a four-month low before recovering to finish at $1,538 an ounce, up 10% for 2012.
Silver was up 1% on the day and 9% on the year, hovering at just above $30 an ounce.
But optimism about global growth supports sentiment as the Federal Reserve keeps its stimulus policy