The 29-year-old midfielder previously played at Hamburg from 2005 to 2008 before leaving to spend two seasons each at Real Madrid and Tottenham.
"I'm enthusiastic that Rafael van der Vaart is playing for HSV again," said Thorsten Fink, favourite to be the first coach to lose his job in the Bundesliga this season. "He will be an important reinforcement for our team."
Van der Vaart, a regular with the Dutch national team for a decade, said on the club's website: "This is a dream for me and my family. I'm looking forward to three great years."
Having finished third, seventh and fourth in the three years Van der Vaart played for them, Hamburg, the only ever-present side in the Bundesliga's 50-season history, narrowly avoided relegation last season as they finished 15th.
They have also made a poor start this term, losing at home to Nuremberg in their Bundesliga opener on Saturday and getting knocked out of the German Cup by third tier Karlsruher the week before.
The news came hours after Van der Vaart was dropped from the Dutch squad for next month's World Cup qualifiers against Turkey and Hungary, with coach Louis van Gaal saying he had not played enough club football recently.
Also moving on is defender Danny Rose who has joined Sunderland on a season-long loan while Real Mallorca have agreed to sign Mexico forward Giovani Dos Santos on a four-year deal,