Updated

Joey Logano gave his hopes of making the Chase for the Sprint Cup champion for the first time a huge boost by winning Sunday's Pure Michigan 400 at Michigan International Speedway.

Logano, who earned the pole with a new track qualifying record at this two- mile racetrack on Friday, grabbed the lead with less than four laps remaining when then leader Mark Martin ran out of fuel. Logano last pitted for fuel with 41 laps to go, while Martin made his stop nine laps earlier.

Logano then held off Kevin Harvick at the finish by one second to claim his third career Sprint Cup Series victory but his first since June 2012 at Pocono, snapping a 44-race winless streak.

"I knew that the 55 (Martin) was two laps short (on gas), but I really wanted to get by him just in case he was fooling with me and was getting great fuel mileage," Logano said. "I knew the 29 (Harvick) was behind me and had about the same speed as me. Just getting that clean air helped so much."

With the win, Logano moved from 16th to 13th in the point standings. He is now 17 points behind 10th-place Greg Biffle, who finished ninth. Biffle was attempting to win at Michigan for the third straight time.

Logano also climbed to third in the wild card rankings. Kasey Kahne continues to hold the first wild card by virtue of his two wins this season. Martin Truex Jr. occupies the second wild card due to his victory earlier this season in Sonoma, Calif. Kahne finished seventh at Michigan. Truex placed 16th.

The series will compete at Bristol this coming Saturday and then run at Atlanta (Sept. 1) before the Chase cut-off race at Richmond (Sept. 7).

"We needed this for our Chase hopes," Logano said. "We're not out of it yet. We got another great racetrack coming up for us after this."

The 23-year-old Logano is in his fifth full season in Sprint Cup competition but his first as driver of the No. 22 Ford for Penske Racing. On Saturday, A.J. Allmendinger drove Penske's No. 22 Nationwide Series car to victory at Mid-Ohio Sports Car Course.

"We betted on Joey when we hired him, and he's certainly been showing the speed and the skill," Team owner Roger Penske said. "To me, it was a great Penske weekend when you think about A.J. down at Mid-Ohio yesterday."

Martin grabbed the lead on lap 174 when Brad Keselowski, who is the defending Sprint Cup champion and Logano's teammate at Penske, gave up the lead to pit for fuel while the race was under the ninth and final caution. Martin held off challenges from Harvick and Logano after the last restart with 23 laps to go, but Logano pulled ahead of Harvick to take the second spot.

"All in all, it was a great weekend for us, but I just mistimed that last restart there," Harvick said. "We got three-wide and lost some track position."

At age 54, Martin was trying to win his first Sprint Cup race since September 2009 at New Hampshire. He ended up finishing one lap down in 27th.

"We knew that we needed an extra caution to make it," Martin said. "We had the speed to pull it off. Usually I hate seeing cautions come out, but I wasn't worried about it."

Martin is in his last season as part-time driver of the No. 55 Toyota for Michael Waltrip Racing. Last Tuesday, MWR announced that Brian Vickers will drive the 55 car full-time in 2014.

Jimmie Johnson, the current points leader and the only driver who has clinched a spot in the Chase, suffered engine failure in the early going and wound up finishing 40th. Johnson had to start from the rear of the field in a backup car after he wrecked his primary vehicle in Saturday's final practice. The five-time series champion held the lead for three laps during a round of green-flag pit stops. His motor expired shortly after.

"The engine broke," Johnson said. "I guess when we came in for our green-flag pit stop, something started then. I made it a few more laps, although I didn't really notice anything. Then I dropped a cylinder on the back straightaway. It's definitely an unfortunate thing. We had plenty of speed in this car."

Johnson failed to finish a race for the first time this season. He entered this 400-mile event with a 75-point lead. His advantage over Clint Bowyer is now 41 points. Johnson has won four races this year. He has yet to win in 24 starts at Michigan.

"On days like today, I'm thankful for the big points lead that we have and the bonus points that we've been able to accumulate to get us in position for the Chase," he said. "I hope to get all of this stuff out of the way now, although I hate losing momentum going into the Chase. It's nice to roll in there hot. I thought we had a chance to win today, but we'll dust ourselves off."

Dale Earnhardt Jr., who is Johnson's teammate at Hendrick Motorsports and a two-time Michigan race winner, had led 20 laps and ran among the top-10 until lap 135 when he cut his right-rear tire and made contact with the wall in turn 2. Earnhardt spent more than 25 laps in the garage for repairs before he returned with a 36th-place finish.

Kurt Busch's third-place run allowed him to move from 11th to ninth in points.

Paul Menard finished fourth, followed by Bowyer and Marcos Ambrose. Jeff Burton took the eighth spot, and Carl Edwards completed the top-10. Keselowski was 12th.

Austin Dillon, substituting for the injured Tony Stewart in the No. 14 Chevrolet, finished 14th. Stewart is expected to miss the next several races while he continues to recover from a broken right leg that he sustained in an accident during a sprint car race earlier this month in Iowa.