Gomes had fallen well down the pecking order at Tottenham in the last two years following the arrivals of Brad Friedel and Hugo Lloris.
He was keen to secure a move back to his homeland in order to try to win back his place in the national squad ahead of the 2014 World Cup, but the 31-year-old has joined Hoffenheim after the Bundesliga side made an approach in the last 24 hours.
The Brazil international joined from PSV in 2008 and went on to become a regular under Harry Redknapp, but a series of high-profile errors saw the former Spurs boss bring in Friedel and Gomes has struggled to get into the starting XI ever since.
The arrival of Lloris from Lyon last summer meant Gomes dropped even further down the pecking order. His last appearance for the London club came in November 2011 and he has rarely made the bench in the last 18 months.
Rangers have been handed a boost ahead of the Old Firm derby at Ibrox on Sunday after Alfredo Morelos signed a new deal that keeps him at the club until 2021.