Stokes was the favourite to take over from Joe Root after the batsman stepped down from the position earlier this month; England had won just one of their previous 17 Tests, a run which included a 4-0 Ashes thrashing in Australia and a 1-0 series defeat in West Indies.
After former batsman Rob Key came in as the new managing director of English cricket, Stokes' appointment was expected to be round the corner.
“I am honoured to be given the chance to lead the England Test team. This is a real privilege, and I’m excited about getting started this summer," Stokes said.
“I want to thank Joe [Root] for everything he has done for English Cricket and for always being a great ambassador for the sport all across the world. He has been a massive part of my development as a leader in the dressing room, and he will continue to be a key ally for me in this role.”
Stokes, 30, has scored more than 5,000 runs and taken 174 wickets in his 79 Tests for England, making him clear favourite for the job.
"I am delighted that he has accepted, and he is ready for the added responsibility and the honour. He thoroughly deserves the opportunity," Key said in a statement.
"I had no hesitation in offering the role of test captain to Ben. He epitomises the mentality and approach we want to take this team forward into the next era of red-ball cricket."
Stokes, who was Root's deputy, took an indefinite break from cricket last year to focus on his well-being while also recovering from a second operation on a broken finger before he returned to the squad for the Ashes series.
England's next Test assignment is a two-match home series against New Zealand in June. The England board has also advertised for separate red-ball and white-ball coaches following Chris Silverwood's resignation in February.
There have been some concerns about the workload of Stokes, who is clearly England's most valuable player across formats. Star all-rounder Andrew Flintoff was also appointed as captain during a similarly tumultuous time in English cricket but not only failed to revive the team but also saw his performance dip.
One of the biggest decisions for Stokes will be the fate of veteran fast bowlers James Anderson and Stuart Broad. The two were controversially dropped from the tour of the Caribbean and, in their absence, the bowling looked fairly toothless.
Key, who did not name a vice-captain immediately, also said that Broad and Anderson will remain part of the squad going forward.
He said: "Before it was announced that I was doing this job, I rang them up and said in my opinion they're both available for selection.
"I told them, 'I can't promise you're going to play but you're available' and Ben Stokes has been very clear he wants Jimmy and Broady to come back in.
"It will purely be done on what is the best XI to win a Test match and if they're in that – there's every chance they will be because they're very good bowlers – they will be."