MacGill and Warne, whose record-breaking Test feats had often kept MacGill out of the team, will form the first legspin duo Australia has taken on an Ashes tour since 1953.
MacGill, his New South Wales teammate Brad Haddin and South Australian quick Shaun Tait were the three additions to the 13-man squad that beat New Zealand 2-0 in a Test series last month.
Chairman of selectors Trevor Hohns said MacGill's strong domestic performances for NSW this season, when he claimed 70 first-class wickets, had earned him a place in the Test squad.
"Stuart has done everything asked of him when he's been included in the Test team and continued to push his cause with several fine performances for New South Wales," Hohns said.
"He is a quality spinning option for us who is quite accustomed to English conditions from his county cricket experiences (with Nottinghamshire)," he said.
MacGill is regarded as one of the unluckiest bowlers in Test cricket. He would normally walk into any side but has been eclipsed by Warne, the greatest legspinner in history.
He has performed well in his 33 Test matches, winning man of the match for an eight-wicket haul in his most recent outing against India in Sydney, but had acknowledged that at 34, this was his last chance to make an Ashes tour.
The selectors named separate Test and one-day squads.
The 16-man Test squad: Ricky Ponting (captain), Adam Gilchrist (vice-capt), Michael Clarke, Jason Gillespie, Brad Haddin, Matthew Hayden, Brad Hodge, Michael Kasprowicz, Simon Katich, Justin Langer, Brett Lee, Stuart MacGill, Damien Martyn, Glenn McGrath, Shaun Tait, Shane Warne.
The 15-man one day squad: Ricky Ponting (captain), Adam Gilchrist (vice-captain), Michael Clarke, Jason Gillespie, Brad Haddin, Matthew Hayden, Brad Hogg, Michael Hussey, Michael Kasprowicz, Simon Katich, Brett Lee, Damien Martyn, Glenn McGrath, Andrew Symonds, Shane Watson.