Wigan stretched their winning run in all competitions to 12 games but needed a late rally and a Josh Charnley hat-trick to see off a dogged Wakefield.
Charnley's early brace put Wigan in charge, but Dean Collis and Danny Kirmond (2) put the hosts 17-10 ahead.
Wigan's Harrison Hansen swapped tries with Kyle Wood, before Charnley's third brought the leaders within one point.
Late scores from Lee Mossop and Darrell Goulding were enough to send the Warriors five points clear at the top.
Sam Tomkins - Wigan's captain on the day in the absence of injured skipper Sean O'Loughlin - was unable to set a new club record by scoring in a 12th consecutive match, but he could be content with a nervy Warriors win that was never certain until Goulding's try in the dying seconds.
Shaun Wane's side took control in the early minutes against an injury-hit Wakefield outfit, who gave a home debut to Taulima Tautai, their recent addition from NRL side Parramatta Eels.
Centre Goulding sent Charnley over in the corner for the first try of the game and the England winger crossed in identical fashion shortly afterwards to reach 20 Super League tries this season.
But Wakefield hit back when Kyle Amor's drive created an opening for Collis, before full-back Richie Mathers set up skipper Kirmond to put the Wildcats two points in front.
Wood broke through a gap in the Wigan line and ran in from 30 metres to stretch the lead further as the Warriors, who have not lost since 15 March, claimed unsuccessfully for obstruction.
Lee Smith's opportunist 40-metre drop goal, in the final play of the first half, typified the change in Wakefield's mood as they sensed an unlikely victory, but Wigan began the second period as they had started the first, as Hansen touched down from close range and Pat Richards converted to make it 17-16.
However, Kirmond danced through the Wigan defensive line to add his second and Wakefield's fourth to restore the Wildcats' seven-point advantage.
A see-saw encounter took another twist as Charnley completed his hat-trick with 20 minutes remaining, and with the game in the balance, Wigan went back in front when Mossop barged through two tackles to score from five metres out.
Richards kicked the conversion and a penalty soon afterwards, before Goulding's first try of the season sealed the win.
Second-placed Huddersfield will reduce the gap at the top of Super League back to three points if they beat St Helens on Monday.
VIEW FROM THE DRESSING ROOM
Wakefield head coach Richard Agar:
"Undoubtedly we're disappointed we didn't come through and get the victory but I don't think we could have asked for much more from the players in terms of effort and commitment today.
"We've had three or four guys who were short of fitness and we had to rely on them for a lot more game time than what they could do.
"Sometimes things like that will happen, and it's about keeping your nerve in those situations.
"The last game-and-a-half that we've played before today has been disappointing, and left us scratching our heads.
"We knew we had plenty of injuries, and it threw our preparation into disarray, and we knew we wouldn't be as fluent with ball in hand, but we did really well, and I just thought we energy got us in the end."
Wigan head coach Shaun Wane:
"I knew that they'd made quite a few changes, and that some of their players would be quite fatigued, and we got them in the second half, but the fact we waited that long was disappointing.
"We fell off the pace of the game after our start, and we weren't consistent enough. In the second half we had a bit of a run and we scored tries, and that's what we do. If we have possession then we can score tries.
"I told the players exactly what I thought of them at the break, and I got the response I desired from them. You have to credit Wakefield though - they did a job and slowed the play-the-ball down, which they were allowed to do.
"You're never going to have a perfect performance, and today was certainly one of those days. We were a little bit off because we had to make a few changes ourselves, which affected our team as well as theirs."
Wakefield: Mathers; Fox, Collis, Lyne, Cockayne; L. Smith, Wood; Poore, Wildie, Wilkes, Kirmond, Walshaw, Tautai.
Replacements: Molloy, Washbrook, Amor, Annakin.
Wigan: S. Tomkins; Charnley, Goulding, Thornley, Richards; Powell, Smith; Flower, McIlorum, Mossop, Hansen, Farrell, Burke.
Replacements: Lloyd, Tuson, Taylor, L. Tomkins.
Referee: Thierry Alibert (RFL).