(CNN) -- World number one Rafael Nadal has avenged his two recent defeats to Roger Federer with a victory over his rival in a charity match in Madrid, Spain.
Wednesday night's clash was the second of two exhibitions aimed at raising money for the pair's foundations, with Federer winning Tuesday's contest in the Swiss city of Zurich.
It was the third time in the last month that the world's top-two male tennis players have met and Nadal's first victory in that period, after Federer won in Switzerland and at the ATP World Tour Finals in London, England.
Twenty-four hours earlier the two stars joined forces to raise funds for Roger Federer's foundation, and the "Match for Africa" raised $2.6 million for the 29-year-old's charity.
The 23-year-old Nadal thanked his opponent for his participation in the match and was pleased the duo could use their status to raise money for a good cause.
"I say thank you very much to Roger for coming here to Madrid and supporting my foundation today," the nine-time grand slam winner told the ATP Tour's official website after winning the match 7-6 (7-3) 4-6 6-1.
"Both of us are very happy that we can finally have this event and raise a lot of money for these kids. I know that with what we're going to raise ... it's not going to be decisive but it will be a help. It's going to be important to improve this world a little bit."
The contest, named the "Joining Forces For the Benefit Of Children" match, attracted an all-star crowd to the Caja Magica, including Spain's Queen Sofia.
Also in attendance was former world number one Carlos Moya, who announced his retirement from tennis in November after a prolonged struggle with a foot problem.