Nadal became the first repeat winner in Madrid, and recovered from two recent quarterfinal losses on clay to win his second title on the surface and third overall this year.
Nadal showed signs of improvement this week compared to his early exits in Monte Carlo and Barcelona, but still didn't look quite like the player who has won eight French Open titles.
"We don't deserve the victory, (Nishikori) deserves it, he played better than us the whole time," Nadal's uncle and coach Toni Nadal told Antenna 3 TV. "We had a lot of luck today. We didn't really come back, he was hurt."
After both players held serve to start, Nishikori jumped out to a 5-1 lead with powerful groundstrokes that overwhelmed Nadal, who couldn't find a way to counter his Japanese opponent.
"After the early breaks (Nadal) got tense and his opponent played at a great level," Toni Nadal said.
After being broken in his first service game in the second set, Nadal slowly clawed back into the match at the Magic Box although Nishikori was already in some discomfort when Nadal broke back for 4-4.
Nishikori needed a medical timeout to treat his sore lower back, and his energy looked sapped as he hit a shot long to concede the set.
Nishikori visibly struggled in the third before eventually retiring.
"I'm very sorry for what happened today for everybody," said Nishikori, who will become the first Japanese player in the top-10 when the new rankings are released. "Unfortunately I was hurting today and I was too hurt to fight."
Nishikori will withdraw from Rome and fly back to Florida to rest and recover for Roland Garros, his agent said afterward.
Nadal's victory guarantees he will stay No. 1 heading into Roland Garros.
Sharapova, who lost to Serena Williams in last year's final, crumbled in the opening set when she held her serve just once.
But Halep's serve dipped in the second set, and Sharapova started hitting pinpoint ground strokes that kept the fifth-ranked Romanian running. The ninth-ranked Russian converted both her break points in the set to even the match.
Sharapova then pulled away in the deciding set with an early break to follow up her triumph in Stuttgart with a maiden title in Madrid.
Since the 2011 French Open, Sharapova has a 47-3 record on clay -- with all three defeats coming to Williams. The top-ranked American was the two-time defending champion in Madrid but withdrew with a leg injury on Friday.
"I don't know how I pulled it off," Sharapova said after winning her 32nd career title. "I came close last year, and I didn't have a great first set today, but I knew it wasn't over until the last point was played."
Sharapova planned to continue her center court celebration on the plane ride to the Rome Masters.
"They better have some champagne for me," Sharapova said. "I need a drink."