The director had been rumoured to be involved and has previously spoken about working on a script for the movie, which will see the return of Daniel Craig as 007.
EON Productions, makers of the film, confirmed Boyle had signed up, saying that production on the 25th Bond film will start in December.
The film, which has yet to be given a title and is due for release in the UK on 25 October 2019, will be Craig’s fifth stint as 007.
Producers Michael G Wilson and Barbara Broccoli said: “We are delighted to announce that the exceptionally talented Danny Boyle will be directing Daniel Craig in his fifth outing as James Bond in the 25th instalment of the franchise.
“We will begin shooting Bond 25 at Pinewood Studios in December with our partners at MGM and thrilled that Universal Pictures will be our international distributor.”
Oscar-winning Boyle, who also directed The Beach with Leonardo DiCaprio, already worked with Craig during the opening ceremony at the 2012 Olympics in London.
He will direct the movie from an original screenplay penned by John Hodge, who also worked on Trainspotting.
Boyle previously said of the rumours: “We’re working on a script at the moment and we’ll see what happens.
“But it’s a great idea so hopefully it’ll work. I’d love to be able to tell you more but I’m not going to.”
Craig is likely to make the movie his last one playing the spy. He has previously starred in Casino Royale, Quantum of Solace, Skyfall and Spectre.
His return surprised many as he said he would rather “slash my wrists” than return to the role.
But he subsequently said he made the remarks two days after he finished shooting Spectre and was feeling exhausted.