Moya dropped the first set, 5-7, but breezed through the next two by identical 6-2 scores and led 3-0 in the fourth when Safin retired with a stomach ailment after 2 hours, 10 minutes.
"I was heading for a victory when Marat had to quit," said Moya, a former world No. 1. "I wish I could have finished it, but this is still a great feeling."
The 26-year-old Moya, a former Barcelona resident, claimed his 12th career ATP Tour title, but his first in Spain. He had stalled in five semifinal appearances here before finally breaking through.
"I often reach the semifinals and then lose," admitted Moya, who also won at Buenos Aires in February. "But I've been serving better as this week went by. I've also played well off my forehand."
Safin had advanced beyond the quarterfinals for the first time this season, one that has been plagued by injuries. His illness prevented him from keeping pace with the Geneva-based Spaniard following a hot opening pace.
Moya, who two years ago lost the title match to compatriot Juan Carlos Ferrero, increased the pressure and his own momentum after dropping a hard-fought first set in 46 minutes.
After beginning the second set with a service break, Moya quickly turned the tide in his favor.
"My game was much better from then on," said Moya, who earned $168,000. "This was not the best way to win this match."