England's Moeen to come out of test retirement for Ashes
He stepped away from the game's longest format to focus on limited-overs cricket but reversed his decision following discussions with test captain Ben Stokes, coach Brendon McCullum and ECB men's managing director Rob Key.
Moeen made his test debut in 2014 and played his last test against India at the Oval in September 2021. He scored 2,914 runs in 64 tests at an average of 28.29, and picked up 195 wickets with his off-spin.
"We reached out to 'Mo' early this week about returning to test cricket. Having had a couple of days to reflect, Mo is excited to join the squad and play test cricket again," Key said.
"His vast experience, along with his all-round ability, will benefit our Ashes campaign."
Leach, who took four wickets in England's win over Ireland in their warm-up test, has been ruled out of the five-test series against Australia due to a stress fracture in his back.
His injury is the latest setback to England's bowling department in the build-up to the series, with fast bowler Jofra Archer also ruled out.
The Ashes gets underway at Edgbaston on June 16.