Having not dropped a set in her first three matches at the Indian Wells Tennis Garden, the former world number one battled back from a set and break down to beat her fellow Russian in just over three hours.
"She did start very well but also it was a poor start from my end," second seed Sharapova said after booking her place in the last four against Serb
"She controlled most of the points and I was on the defence a lot. That created so many opportunities for her, and she gained so much confidence after that.
"Then I started moving a lot better. I don't know if I wasn't seeing the ball well in that first set. It seemed like when I had my opportunities to move forward, I took an offensive ball and made it defensive for some reason."
Sharapova had lost to Kirilenko in their previous meeting, in the first round of the 2010 Australian Open, and she faced an uphill task on Thursday when trailing 3-6 and 0-2 on a balmy evening in the California desert.
Kirilenko, the 20th seed, has established something of a reputation as the WTA Tour's iron woman this season after winning eight of her nine three-set matches.
Asked whether she had considered the prospect of defeat after going a break down in the second set, Sharapova replied: "No, because I knew that I could have played better.
"If I felt like everything was going so well from my end and she was just playing so good, then I would have felt like, 'Okay, well, she's just too good.' "But I really felt like I could improve on so many things during the match and change things around. Little by little, I started doing those things better."
Sharapova, a winner of three Grand Slam singles titles, broke Kirilenko in the fourth and sixth games of the second set to lead 4-2 before she failed to hold in a marathon seventh that ended when she hit a backhand long.
Kirilenko's composure was tested in the 10th game when, serving at 30-15, she was penalised a point by the chair umpire for tapping her racket on the ground three times while Sharapova was hitting a return.
"It's not something I've ever come across, maybe in the 12-and-unders, but not very recently," Sharapova smiled. "It's very rare.
"It's one thing if you do it once, but she did it three or four times. That's a whole other story. It's not like a hockey puck or something. She forgot the sport."
After consulting the umpire for explanation, Kirilenko won the next point with a scorching forehand winner down the line and eventually held for 5-5 after saving two break points.
Sharapova immediately responded, holding serve in the 11th and going 0-40 up on Kirilenko's serve in the 12th before winning the set on her third opportunity when her opponent netted a forehand.
In final set, Sharapova broke Kirilenko three times, sealing victory in three hours, five minutes when her opponent double-faulted.
The Russian former world number one will take on Ivanovic, another former world number one, in the semi-finals on Friday.