The UK's emissions of climate-warming gases surged in 2012 as cheap coal replaced gas in power stations, official data revealed on Thursday.

However, 2012 was a record year for renewable energy in Scotland, which produced enough electricity to power all of its homes. Fergus Ewing, the Scottish energy minister, said his government was now on track to meet its target of generating the equivalent of 50% of Scotland's own electricity needs by 2015 and 100% by 2020.

The UK's carbon dioxide emissions rose by 4.5% from 2011-12, with coal use in power stations jumping by 31%. Coal prices have dropped significantly as the US has exported the coal it no longer needs at home due to the shale gas boom. Another factor is that many of the UK's coal-fired power stations must close soon, due to European pollution regulations, meaning they have been using up their allotted hours. The gas used in power stations dropped by 31%.

But there was a jump in the gas used to heat homes due to a cold last quarter of 2012, which the department for energy and climate change said had been 2.3C colder than Q4 2011. The cold weather in the UK in recent weeks led to gas reserve levels falling to just two days worth, with the price spiking as a result.

Emissions rose in the business sector, despite the UK's flatlining economy. But pollution from transport – a quarter of all emissions – fell by 1.2%. Overall, the UK's emissions remain about 20% lower than in 1990, largely due to gas replacing coal and some industry moving manufacturing abroad. The statistics also showed that UK imports of energy were higher in 2012 than for several decades.

"Emissions are now 26% lower than 1990, meaning we're on track to meet our legally binding targets," said energy and climate change secretary Ed Davey. "But the line on the graph is unlikely to be totally straight, as factors such as the weather and fluctuations in the precise energy mix vary the picture from one year to the next. The UK's continued shift to low carbon will be accelerated by the green deal to help householders overhaul their properties, and by our energy bill's reforms to the electricity market to bring on investment in renewables, new nuclear and CCS."

Nick Molho, head of energy policy at WWF-UK, said: "The government's role on energy is threefold: ensuring energy security, keeping bills down and decarbonising our energy system. These statistics are worrying, because they show that the UK is going the wrong way in all these areas. Increased reliance on fossil fuel imports is the main problem we face and the sad thing is that it's government policies, notably driven by the Treasury, that are causing this."

Kathy Cumming at Greenpeace said: "These figures show the 'greenest government ever' is failing in its bid to shift the UK to a low-carbon economy. The two best things it could do in order to redeem itself are support Tim Yeo's energy bill amendment, which would remove carbon from the electricity sector by 2030, and put an end to coal burning."

The statistics came out on the day that energy minister John Hayes – an outspoken opponent of onshore wind farms – was moved out of the department. His replacement, Michael Fallon, will also retain his post at the department of business, which some stakeholders hope will mean the coalition doing more to boost investor confidence in the energy sector, which needs £110bn by 2020.

In Scotland, renewable energy output has continued to grow markedly, hitting a new record of 14,600Gwh in 2012, up by 7% on the previous year. Windfarm output was four times greater than in 2006.

Scottish wind and hydro schemes generated 35% of the UK's total renewables output in 2012, and that – averaged out across the year – provided enough green electricity for every home in Scotland.

"It was another record year for renewables in Scotland," Ewing said. "Scotland also contributed more than a third of the entire UK's renewables output, demonstrating just how important a role our renewable resource is playing in terms of helping the UK meet its binding EU renewable energy targets."

The industry body Scottish Renewables said £1.5bn had been invested in renewables in Scotland last year – more than double the spending in 2011 – but there are doubts within the industry and among investors about whether the 100% target can be achieved. Hitting that target will rely heavily on expensive and technically challenging large offshore windpower schemes; there is much less capacity for larger onshore schemes.

The Scottish government is under intensifying pressure from environment and climate campaigners to improve its CO2 emissions reduction and climate strategies, after admitting it had failed to meet its 2010 reduction target.

The UK's official committee on climate change said the very cold winter in 2010 was largely to blame for the missed target, but Stop Climate Chaos Scotland said the government would miss its targets for several years to come because its climate strategies were too weak.

The Scottish government's targets are highly dependent on the EU increasing its CO2 reduction targets from 20% to 30%, but that is not expected before 2016. While anxious to champion energy investment, Scottish ministers are very reluctant to target motorists or cut road building, and are accused of under-investing in home insulation and low-carbon motoring.