Winger Jermaine McGillvary's hat-trick enabled Huddersfield to stay top of Super League, but only a disallowed try in the last minute ensured they retained their 100% record.
The Giants could hardly have made a better start, with McGillvary scoring two tries in the first eight minutes after stand-off Danny Brough and winger Aaron Murphy, both former Wakefield players, had counter-attacked with devastating effect from their own quarter.
McGillvary took Luke Robinson's cut-out pass to cross unopposed for his first score and then won the race to Scott Grix's grubber kick to the line. Brough was wide with both conversion attempts and the slow-starting Wildcats gradually clawed their way back to parity.
Full-back Richard Mathers took advantage of second rower Ali Lauitiiti's offload to get winger Peter Fox over for a 13th-minute try and Paul Sykes added the conversion before putting over a penalty eight minutes before half-time to tie the scores.
Huddersfield missed a scoring chance when hooker Shaun Lunt knocked on over the line, but they turned around 12-8 in front thanks to a couple of penalties by Brough as he made amends for his earlier misses. The Giants always looked the more enterprising team and they duly extended their lead four minutes into the second half.
Grix burst clear from David Faiumu's defence-splitting pass and, although Fox got back to haul down Brough, the Wakefield defence could not regroup in time to prevent McGillvary taking Robinson's long pass to complete his hat-trick.
The powerful winger was forced out of the action on 55 minutes after being hurt attempting a tackle on Wakefield's dangerous Ben Cockayne, but must have thought he had done enough to secure the points for his side. Brough's third goal made it 18-8 but the visitors spent most of the second half on the defensive.
Wakefield had plenty of possession but their handling too often let them down and they struggled to break down the best defence in Super League until Australian centre Dean Collis broke from deep inside his own half.
Mathers was hauled down 20 metres out after taking Collis' inside pass but, from the next play, Cockayne found space out on the flank and centre Lee Smith touched down his kick to the line.
That cut Huddersfield's lead to 18-12 and it was down to just two points eight minutes from the end when Tim Smith's long pass was deflected by defender Leroy Cudjoe into the grateful arms of Cockayne, who scored his sixth try of the season.
Sykes was again off target with the conversion but Wakefield thought they had snatched victory in the final minute when Lee Smith took Tim Smith's short pass, but referee Richard Silverwood ruled it forward.