Ranieri agrees two year Roma deal

"There is an agreement," his lawyer Mattia Grassani told Reuters by telephone. "Tomorrow he will sign a two-year deal."

Roma lost their opening two league games and have struggled to reinforce their squad in the transfer market.

"I have given my resignation and the club have accepted it," Spalletti told reporters after meeting club president Rosella Sensi.

Roma thanked Spalletti for his work in a statement and said his contract, which was to run until June 2011, had been resolved mutually.

Former Udinese coach Spalletti was appointed in 2005 and helped a stylish Roma finish second in Serie A in 2007 and 2008.

They also won the Italian Cup in both those years but started last season badly and ended up sixth in the league.

Their spending power had become limited under Sensi but separate takeover talks with billionaire investor George Soros and a Swiss consortium fell through.

Supporter unrest grew at the end of last season and Spalletti, who had been linked in the media with the Juve job after Ranieri's sacking in May, held talks with Roma about his future and opted to stay.

However, the sale of midfielder Alberto Aquilani to Liverpool and the lack of major buys increased the frustration.

A 3-2 defeat at Genoa in this term's league opener and Sunday's 3-1 loss at home to Juventus sealed his decision to leave despite Roma's progression from the Europa League playoffs.

Ranieri led Juve to third spot in 2008 in their first season back in Serie A after a demotion for match-fixing but was replaced by Ciro Ferrara towards the end of last season after a run of bad results.