Nick Scruton scored a vital second-half try to help Wakefield overcome Widnes and extend their unbeaten run under James Webster to five matches.
Widnes piled pressure on the hosts in the first half, but Danny Tickle's try was all they had to show at 4-0 up.
Tim Smith crossed after the break before putting Scruton over, with Paul Sykes crucially converting both tries.
Stefan Marsh grabbed a second try for Widnes, with Wakefield's defence twice denying Patrick Ah Van near the line.
Wakefield move to within two points of the Vikings in eighth place with their fourth win in five matches since Webster took over from Richard Agar last month.
|Wakefield rise as Widnes stall|
|Wakefield are now unbeaten in five Super League games after wins over Widnes, Leeds, Wigan and London Broncos, and a draw against Hull FC.|
|Widnes Vikings' only win in their past eight Super League matches was a 42-24 win over bottom side London last month.|
The in-form Wildcats stubbornly held Widnes at bay for 18 minutes before Tickle latched onto a Joe Mellor pass to burst over the line from close range.
However, Tickle failed to add what would prove to be the vital extras with a seemingly straightforward conversion.
While the visitors continued to dominate possession and force Wakefield to toil in their own half, they did not seriously threaten to add to their advantage.
Richard Owen went closest to levelling before the break, but the video referee denied the utility back as he was adjudged to be in touch as he went over in the corner.
The second half started with Ah Van picking off a pass from Wakefield scrum-half Smith and running almost the full length of the pitch before being hauled down just short of the tryline by centre Jimmy Keinhorst.
Soon after, Smith pounced at the other end when Widnes prop Alex Gerrard spilled the ball backwards in a tackle as he tried to run it off his own line.
Sykes put Wakefield ahead before Smith linked up with Scruton, who charged in to score from 10 metres out just 24 hours after re-committing to the club with a new two-year deal.
Marsh set up a tense finish after making the most of Richie Mathers' failure to clear the danger caused by a speculative Mellor kick into the corner, and Tickle was successful with his touchline conversion to make it 12-10 late on.
With one last assault on Wakefield's line, Ah Van took a Jon Clarke pass to barge over by the corner in the final minute, only to lose the ball as he was repelled backwards.
Wakefield Trinity Wildcats head coach James Webster:
"The amount of defence we had to do in the first half was unbelievable.
"It was no different to what we had to do against Hull FC and at times against Leeds. Yet again the boys have found a way.
"My press conferences are pretty boring at the moment because I'm repeating myself every week. They're trying ridiculously hard and are playing hard for each other.
"That's not me - it's them. They've a commitment to each other to get out there and work hard for each other. The proof is in the pudding - they got the result yet again."
Widnes Vikings head coach Denis Betts:
"I'm sat here frustrated because it was a game we should have won.
"Effort gives you a chance of winning games but sometimes you have to be smarter than that. We have somehow got to keep up that level of effort and come up with a bit better footie on top of it.
"I know we keep falling over, but I honestly believe we're falling forward.
"We've played particularly well in the last two weeks - we just haven't got anything on the board to show for it, which is what it's all about."
Wakefield: Mathers; Owen, Keinhorst, Lyne, Riley; Sykes, T Smith; Moore, Wildie, Scruton, Gilmour, Ryan, Washbrook.
Replacements: McShane, Raleigh, Tautai, Lauitiiti.
Widnes: Hanbury; Ah Van, Dean, Marsh, Flynn; Brown, Mellor; Cahill, Clarke, Gerrard, Galea, Tickle, Leuluai.
Replacements: White, Isa, Joseph, Allen.
Referee: Ben Thaler (RFL)