The American rock band, who will take over the Pyramid stage on Saturday 24 June, revealed the news during a free concert in Frome, Somerset, on Friday evening.
The announcement was made via a live stream from the site at Worthy Farm in Somerset.
Video showed Glastonbury founder Michael Eavis introducing the group before their headline slot was confirmed.
Foo Fighters were forced to cancel their Glastonbury 2015 appearance after the band’s front man Dave Grohl fell and injured himself during a gig in Sweden earlier in June of that year.
Festival organiser Emily Eavis said: “We’re incredibly lucky to have the Foo Fighters headlining on the Saturday night this year.
“It was obviously devastating when they had to pull out in 2015 - and the thought, effort and generosity they’ve put into this announcement is just unbelievable.”
Earlier this week London Grammar confirmed their appearance at this summer’s festival.
Other confirmed acts include headliners Radiohead as well as Wiley and The Avalanches.
Ed Sheeran is also rumoured to complete the headline bill with Michael and Emily Eavis confirming that a full lineup announcement will be made next month.
The organisers also revealed a new area that will launch at this year's festival.
Glastonbury 2017 will be the last until 2019 due to the planned fallow year.
Spin-off event the Variety Bazaar will take place in a different location in 2021.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies