“Yesterday I played my last match as a professional,” Van Nistelrooy, 35, told a news conference.
“I think the moment has come for me to stop playing football — I have reached my physical limit,” he added.
“But there could be no better way to say goodbye than this, in a euphoric moment for the club,” which on Sunday won a place in next season’s Champion’s League with a fourth-place finish in Spain’s La Liga.
During his two-decade career, Van Nistelrooy was crowned top scorer in three countries — The Netherlands, England and Spain.
With 60 goals in the Champions League, he remains that competition’s second-highest scorer, behind Raul of Spain.
He played for five seasons with Manchester United, winning the English league once with them, and then played a part in two Liga titles during four seasons with Real Madrid.
He moved to Malaga last year after a two-season stint with Hamburg.