LONDON — Britain’s economy shrank 0.3 percent at the end of 2012, according to data released Friday, with a North Sea oil production slump, lower factory output and a hangover from the London Olympics pushing it perilously close to slipping into recession for a third time since 2008.

The figures from the Office for National Statistics were sharply lower than the 0.1 percent decline forecast by analysts.

The news is a blow for Britain’s Conservative-led government, which a day earlier defended its austerity program against criticism from the International Monetary Fund. The government needs solid growth to meet its budget targets, keep a triple-A debt rating and bolster its chances of winning a 2015 election.

The pound fell to its lowest in 13-1/2 months against the euro and hit a five-month low against the dollar in response to the data. The euro was also buoyed by a stronger-than-expected survey of German business sentiment by the Ifo Institute.