Great Western Railway (GWR) revealed that the “rock royalty” had used its service to get to Worthy Farm in Somerset on Friday.
There had been mounting speculation that the Foo Fighters would take to the main stage on Friday from 6.15pm in a slot which was billed under the name The Churnups.
Posting a picture of frontman Dave Grohl with a GWR staff member, the official account tweeted: “Even rock royalty knows that there is no better way to travel to Glastonbury than by train!”
Referencing the band’s secret alias, GWR added: “You never know who is going to churn up on board our trains!”
An hour before the slot, the band posted a photo of flags within the festival crowd, one with the phrase Churn It Up brandished across it, and tagged the post #Glastonbury2023.
Following a performance of The Pretender, Grohl said: “You guys knew it was us this whole time, you knew it.
“We’re not good at secrets.”
Grohl also dedicated the last song of the surprise mainstage set to the band’s late drummer Taylor Hawkins.
The drummer died suddenly in March aged 50 while the group were on the South American leg of their world tour.