Boris Johnson has said all of the UK's electricity is going to come from clean energy sources by 2035.
Speaking from Manchester, the prime minister said the target could be achieved through advances in wind power and other renewable sources.
The shift towards renewable energy is part of government efforts to cut carbon emissions by 78% by 2035.
However some green groups have warned that the UK is behind schedule for meeting its target.
Mr Johnson's commitment comes ahead of the COP 26 conference, a global United Nations summit on tackling climate change to be held in Glasgow.
Speaking to reporters, Mr Johnson said "We can get to complete clean energy production by 2035.
"We can do for our entire energy production by 2035 what we're doing with internal combustion engine vehicles by 2030," he said in a reference to the incoming ban on selling petrol and diesel-powered cars.
The prime minister argued that the move would reduce the UK's dependence on energy from overseas "with all the vagaries in hydrocarbon prices and the risks that poses for people's pockets".
Being reliant on "our own clean power" would help keep costs down, he added.
Can the UK meet the 2035 target?
In declaring an end to fossil fuel electricity the prime minister is following advice of his Climate Change Committee, which says it's an essential staging post to reducing emissions to almost nil across the economy by 2050.
But hitting the 2035 goal won't be easy - especially at a time when finances are squeezed.
And the public won't appreciate any home-grown energy shortages.
Renewables, especially offshore wind, will be the backbone of the shift to clean power.
The UK will also need much more energy storage, either in batteries or other methods such as liquid air.
Hydrogen produced by surplus electricity is also expected to play a small part.
Nuclear and carbon capture and storage, where carbon emissions are stored in rocks will have a minor role too.
But there will need to be real urgency. A recent analysis found UK renewables growth is at its slowest since 2010.
Earlier this year, the National Grid said Great Britain's electricity system had been the greenest it had ever been on Easter Bank Holiday Monday.
Sunny and windy weather had led to a surge in renewable sources, with low-carbon energy sources making up 80% of Britain.
However, despite increased use of renewable energy sources, some environmental groups have warned that the government's policies will not be enough to meet its climate goals.
Last month, the Green Alliance said that unless the net-zero strategy "met the scale of the challenge... the UK will be headed into Glasgow with little to show by way of progress on cutting its emissions in this crucial decade."
The think tank urged the government to reduce the use of high-carbon materials such as steel and cement; stop airport expansion and produce a strategy to insulate homes.
But, the group did praise the Department for Transport saying it was halfway to meeting its targets largely due to plans to electrify motoring.