Downing Street had argued the prime minister was too busy preparing for the budget.
The prime minister has reversed an earlier decision not to go to the COP27 climate summit in Egypt.
No 10 had said Rishi Sunak was too busy preparing for the 17 November budget to attend the event which opens on Sunday.
But this had been widely criticised by environmentalists, opposition parties and climate adviser Alok Sharma.
Mr Sunak tweeted that there would be “no long-term prosperity without action on climate change” or energy security without investing in renewables.
“That is why I will attend @COP27P next week: to deliver on Glasgow’s legacy of building a secure and sustainable future.”
On Tuesday, former prime minister Boris Johnson said he would attend COP27 in Sharm El Sheikh.
The UK hosted last year’s COP (Conference Of The Parties) in Glasgow.
Green MP Caroline Lucas welcomed what she called a “screeching U-turn” after “an embarrassing mis-step on the world stage”.
“Let this be a lesson to him – climate leadership matters,” she added.
Deputy Labour leader Angela Rayner said it was “embarrassing” the prime minister had been “dragged kicking and screaming into doing the right thing”.
Liberal Democrat climate change spokesperson Wera Hobhouse said: “This whole debacle has shown the environment is simply not a priority for Rishi Sunak. He’s only going after being embarrassed by Boris Johnson’s attendance.”
Many world leaders including US President Joe Biden and France’s Emmanuel Macron are due to go to the UN event.
Mr Sunak’s predecessor Liz Truss had been set to attend and Scotland’s First Minister Nicola Sturgeon will also be there.
On Tuesday, Mr Sunak’s official spokesman said “significant progress” was being made on the financial statement.