The Australian Open champion had won 20 matches in a row so far this season but came unstuck against 24-year-old American Fritz, who triumphed 6-3 7-6 (5) to land the biggest victory of his career so far.
Nadal had battled through several close matches to reach the final and needed treatment at the end of his semi-final against Carlos Alcaraz on Saturday.
It was clear from the start of Sunday’s final that all was not well, with Nadal declining to chase down balls, rubbing his chest and losing the first four games.
He went off court at the end of the first set with the doctor but decided to carry on and had his chances in the second despite his struggles.
The Spaniard will prioritise finding out what the problem is, saying: “When I’m breathing, when I’m moving, it’s like a needle all the time inside. I get dizzy a little bit because it’s painful. It’s a kind of pain that limits me a lot. It’s not only about pain, I don’t feel very well because it affects my breathing.”
Nadal had already decided not to play in the Miami Open over the next fortnight and will instead have a short break before the clay-court season begins next month.
He said of his first defeat of the year: “I wanted to make it perfect before clay. It has been very, very, very beautiful. Honestly I am sad because of the way I was not able to compete. It’s tough to have these feelings, every day, but in the final it’s very, very ugly.
“But I am not the kind of person that goes down or goes very high emotionally depending on the moment. I am normally stable, putting everything in perspective.
“Of course, the last two months have been amazing, unforgettable, very emotional. I enjoyed things that I never thought I could live again a few months ago.
“Now is the moment to try to solve this problem as soon as possible, try to start on clay. The thing that worries me is about what’s going on there, what I have to do now to recover and how long it’s going to take.”
Going into the final, the concern was over Fritz, who picked up an ankle problem late on in his semi-final against Andrey Rublev and cut short his practice session on Sunday after only a few minutes.
The American grew up only two hours away from Indian Wells and visited the tournament as a child, and he said: “This is seriously like a childhood dream come true, like a wild dream you never expect to actually happen.”
Fritz was worried he would not even be able to take to the court, saying of his warm-up: “I took one push-off step, I literally screamed. I tried it twice more. Both times, the worst pain imaginable. I was really upset, basically almost crying because I thought I was going to have to pull out.
“I went to the doctor. We did a lot of work on it. We tried to numb it up and stuff like that.
“A lot of members of my team wanted me to not play the match. I’m never going to let them forget that because I went on the court and it was a complete non-issue, didn’t feel it at all, didn’t hinder me at all.”
Additional reporting by PA.