The Spanish world number one edged a tight quarter-final opening set but his game then fell apart at the start of the second allowing the Latvian seventh seed to race into a 3-0 lead.
However, Nadal came back strongly to seal a 7-5 6-4 victory and a place in the next round, where he will face qualifier Peter Gojowczyk.
The German beat compatriot Dustin Brown 6-3 3-6 7-6 (7/5) to progress to his first semi-final on the ATP Tour.
The other semi will see Germany's Florian Mayer line up against Frenchman Gael Monfils.
Mayer survived a tough last-eight match-up with Victor Hanescu, eventually winning 6-4 6-7 (6/8) 6-4 against the Romanian.
Monfils, on the other hand, needed just 48 minutes to get past German Daniel Brands 6-2 6-1.