His new club announced the news on Saturday night after HSV's 1-0 defeat at Dortmund, which left Bruno Labbadia's side fifth in the table. The legendary 33-year-old forward has a contract in the northern port city until June 2011.
"I am really very happy that everything is in place and I look forward to coming to Hamburg on Monday," said the Dutchman, who will officially be unveiled by Hamburg at the start of next week. "Hamburg are a great team with a strong squad and large ambitions, which I also have."
The former Manchester United ace has scored 46 goals in 68 league games for Real, but has struggled to make the team this season because of injury. He retired from international football after Holland were knocked out of Euro 2008 by Russia in the quarter-finals.
Van Nistelrooy was the Champions League's top-scorer in 2002, 2003 and 2006 and has scored 49 goals in 64 appearances in European football's most lucrative competition. He is the only player to have been the top-scorer in the Spanish, English and Dutch leagues.
"Ruud has proved his qualities with one of the top international clubs," said Labbadia. "I am convinced that he will shoot important goals for Hamburg. It shows this club's standing that a player of Ruud van Nistelrooy's calibre would choose to come to Hamburg."