The Spanish left-hander enthralled a near-capacity crowd at the Indian Wells Tennis Garden, coming from a set down in the fourth round to improve his record this year to 14-1 on his return from seven months on the sidelines with a knee injury.
Nadal showed no visible sign of discomfort as he took control in the last two sets, though he was unable to move as freely as he would have liked, especially forward and back, against a player known for his audacious shot-making.
"Thursday my movements weren't perfect, you know," said the 26-year-old, a twice champion at Indian Wells who won his 11th grand slam title at the French Open last June.
"Against a player like Ernests, the right thing to do, in my opinion, is play against his backhand and change to his forehand quick, no? But, today I didn't have legs for that.
"Changing direction from behind not from side is much more difficult, so I felt more comfortable with my movements playing against his backhand. I felt if I changed directions I had to run more, too."
Asked how his knee felt after his second match in five days, Nadal replied: "I said before the tournament my knee is some days good, some days not that good. Today so-so.
"But I fight. I fight every ball. I tried my best in every moment. I know I cannot go to some balls that in the past I went on Thursday, but I will do it in the future.
"So to win matches on days like today(Thursday) is more important than ever for me, and I am very happy about what I did on court, happy about the attitude," added the Spaniard, who had his left knee taped up through the match.
Playing his first hard-court event in a year, Nadal looked sharper and more confident with his movement about the court from the second set, and sealed victory in two hours 33 minutes after he broke Gulbis in the penultimate game of the third set.
Fifth seed Nadal, who was gifted a place in the last 16 when Argentina's Leonardo Mayer withdrew before their third-round match with a back injury, will next meet long-time rival and defending champion Roger Federer.
The two have not played since last year's semi-finals at Indian Wells where the Swiss triumphed 6-3 6-4, and this will be the earliest they have clashed at a tournament since their first meeting in 2004.
"Feels like it happened 100 years before," Nadal smiled as he reflected on his 6-3 6-3 victory over Federer in the third round of the ATP Masters 1000 event in Miami nine years ago.
"We have played many after that. Friday will be a nice match. Always to play against Roger is a pleasure. This match arrives early for me, too early to go to the match with the feeling that I can play equal conditions than him."
Nadal, who has enjoyed a successful tournament run on clay in recent weeks, winning two ATP titles after reaching three finals, played down his chances of beating second seed Federer in the last eight.
"I think I am not that level today, but I gonna try, as I do always," said the Spaniard, who leads 18-10 overall in their career meetings.
"I gonna try to enjoy the match. I'm going to try to play well, make the match positive for me with any result.
"I am here in Indian Wells in quarter-finals. Two weeks ago I didn't know if I would be able to be here. So being in the quarter-finals is a fantastic result for me, and we'll see."
Results on Wednesday from the eighth day of the ATP Masters and WTA BNP Paribas Open (x denotes seeded player):
Men
Fourth round
Jo-Wilfried Tsonga (FRA x8) bt Milos Raonic (CAN x17) 4-6, 7-5, 6-4
Kevin Anderson (RSA) bt Gilles Simon (FRA x13) 6-3, 1-6, 6-4
Tomas Berdych (CZE x6) bt Richard Gasquet (FRA x10) 6-1, 7-5
Roger Federer (SUI x2) bt Stanislas Wawrinka (SUI x18) 6-3, 6-7 (4/7), 7-5
Andy Murray (GBR x3) bt Carlos Berlocq (ARG) 7-6 (7/4), 6-4
Juan Martin del Potro (ARG x7) bt Tommy Haas (GER x19) 6-1, 6-2
Rafael Nadal (ESP x5) bt Ernests Gulbis (LAT) 4-6, 6-4, 7-5
Women
Quarter-finals
Maria Kirilenko (RUS x13) bt Petra Kvitova (CZE x5) 4-6, 6-4, 6-3
Maria Sharapova (RUS x2) bt Sara Errani (ITA x6) 7-6 (8/6), 6-2