The New Zealander had taken six for 66 in Nottinghamshire’s first innings and followed that up with a devastating burst in the evening sunshine which scuppered the visitors’ hopes of setting Lancashire a testing victory target.
Wagner ended with five for 45 in the second innings, and 11 for 111 in the match, and with Jimmy Anderson providing high-class support with three for 29 in 22.5 overs, Notts were dismissed for 175 - leaving Lancashire needing only 86 to win on the last day.
Anderson, who had bowled well but without luck in 16 wicketless overs in the first innings, had to wait another 11 in the second as the Nottinghamshire openers battled to erase a deficit of 90.
But he finally had something to celebrate when he removed the off stump of former Lancashire all-rounder Steven Mullaney, who ground out 21 from 104 balls in a stand of 52 in 35 overs.
Tottenham Hotspur loanee impresses Preston North End boss as plan comes together in Carabao Cup demolition of Huddersfield Town
Preston 0-0 Hull: 32 pictures of the fantastic scenes of flags and a packed Town End at Deepdale
Match Report: Huddersfield Town 4-1 Preston North End - PNE turn on the style in the Carabao Cup
Preston North End transfer news: North West rivals plot move for Lilywhites striker, Stoke City monitoring League One star boy
Carabao Cup second round draw details revealed as Everton, Leeds United and Newcastle United prepare to enter the competition
That was the least Anderson deserved in an afternoon spell of 11-3-17-1 from the Pavilion End, and he returned after tea to win an lbw decision against Riki Wessels.
Then Wagner took over. He had already pinned Michael Lumb lbw with a full swinging delivery, but it was a brace of well-directed short balls that accounted for Samit Patel and Stuart Broad - helped by athletic catches by two of Lancashire’s youngsters, Liam Livingstone diving forwards at deep square leg to take Patel’s top-edged pull, and Haseeb Hameed diving to his right at short leg to snap up Broad.
In his next over Wagner bowled Jake Ball with a beauty that clipped the top of off stump, and he was on a hat-trick when he won another lbw decision against Jackson Bird, with another swinging yorker - his fourth wicket in 19 balls.
Harry Gurney denied Wagner the hat-trick but Anderson had him caught behind a couple of overs later, leaving Notts captain Chris Read, who had top-scored in their first innings with 52, unbeaten on 25.
Greg Smith was their top scorer in the second innings with a watchful 41 from 131 balls before he was deceived in the flight by Simon Kerrigan, who also bowled tidily.
At the start of the day Lancashire were only able to add 21 runs to their overnight total, with Ball claiming the key wicket of Livingstone - lbw for 70 off 124 balls, in his first innings in first-class cricket.
Ball ended with four for 63, giving the tall England Lions seamer 13 wickets in three innings so far this season.
But Notts now need something spectacular if they are to avoid following their opening victory against one of last season’s promoted teams, Surrey, with defeat against the others.