Danny Kirmond scored a decisive late try as Wakefield moved into the play-off places with a hard-fought victory over a combative Widnes side.
Ryan Hansbury gave the Vikings a 10-6 interval lead with two tries, either side of one from Kyle Amor.
Richie Mathers and Ali Lauititi crossed for Wakefield after the break, with Paddy Flynn replying for Widnes.
At 18-18, the Wildcats surged forward and Kyle Wood switched play to give Kirmond the opening to seal the win.
The victory lifted the hosts into eighth place for the first time this season, one point clear of Bradford, and they will go into the play-offs if they win their final regular season game at Salford on Friday.
With so much at stake, there was plenty of tension among the Wakefield fans and there was little to encourage them in an error-strewn first half in which Hansbury was the stand-out player.
His first try came after a break down the left and he added another moments before the interval by receiving the ball from Frank Winterstein and collecting his own chip before touching down.
Wakefield needed a positive response and when full-back Mathers cut inside for his eighth try of the season, it looked like they might pull away from opponents, who went into the game having conceded over 1,000 points this season.
Widnes had other ideas, however, and their tackling remained committed as they looked for a win to lift them off the foot of the table.
Flynn crossed in the right corner before a 40-metre run from Frankie Mariano led to a try by the powerhouse Lauitiiti and when Paul Sykes kicked a 67th-minute penalty, the Wildcats finally had their noses in front.
Back came Widnes and Hanbury levelled from 40 metres, but their efforts went unrewarded as Wakefield mounted one final charge and Wood spun it back to the right where Kirmond ignored the man on his outside to force his way over the line and seal a sixth successive win.
VIEWS FROM THE DRESSING ROOM
Wakefield Wildcats coach Richard Agar:
"There is almost a feeling in the changing room of a loss, but at the start of the year we would have settled for any win and that shows how far we've come.
"We showed enough quality for the third week in a row to come up with a late win.
"I think both coaches will be frustrated and really disappointed with the amount of skill both teams showed. There was plenty of effort but both lacked skill and composure and any imagination.
"I thought our offensive game was a complete write-off. We were lucky to get away with it on the back of our errors and the amount of defending we had to do. We really lost our focus on attack."
Widnes coach Denis Betts:
"We put ourselves in that situation with some mental errors.
"I'm really proud of the efforts. Wakefield have been in these games for the last few weeks and it showed they were able to cope with that.
"We were a bit edgy. With a bit of composure, we could have got more rewards.
"There was loads of effort, we just need to knock a few rough edges off, but we're moving in the right direction.
"Defensively we've got better in the second half of the season."
Wakefield: Mathers, Fox, Collis, L. Smith, Cockayne, Sykes, T. Smith, Amor, Ellis, Raleigh, Lauitiiti, Kirmond, Washbrook.
Replacements: Wood, Mariano, Johnson, Wilkes.
Widnes: Briscoe, Flynn, Marsh, Phelps, Isa, Craven, Hanbury, Pickersgill, Clarke, S. Kite, Winterstein, Allen, Cahill.
Replacements: Davies, Kavanagh, Gerrard, McShane.
Referee: James Child (Dewsbury)