The 33-year-old had been strongly linked with West Ham, Tottenham and Stoke, but instead decided to join Hamburg.
The former Manchester United star passed a medical at Hamburg on Saturday.
Van Nistelrooy has signed a one-and-a-half-year contract at Hamburg.
“I am very happy that it worked out and look forward to Monday when I will arrive in Hamburg,” Van Nistelrooy said on the club’s official website.
“Hamburg is a fantastic club with a strong team and great ambitions. I also have great ambitions.”