But the Robins goalkeeper Phil Smith rivalled him for man of the match honours with a string of fine saves in an end to end affair.
It was Cox who opened the scoring for the visitors after 15 minutes with a great angled shot.
Scunthorpe were back on level terms 12 minutes later when Grant McCann curled a free-kick into the top corner.
Keeper Smith then pulled off a series of excellent saves to keep the visitors on level terms.
Scunthorpe finally went in front in the 50th minute when winger Martyn Woolford crashed a shot into the top corner from close range.
But two minutes later Cox broke through the offside trap to score an excellent equaliser with a chip over home goalkeeper Joe Murphy.
Scunthorpe were back in front again in the 58th minute when central defender Krystian Pearce headed home from a McCann free kick.
Midfield man Matthew Sparrow also had an effort kicked off the line, before Cox completed his treble from the penalty spot in the 79th minute, after striker Billy Paynter had been brought down.
The result leaves Scunthorpe a point clear at the top of the table, but manager Nigel Adkins admitted after the game that his side must tighten up defensively if they are to be considered real promotion contenders.
For Swindon it was a continuation of their revival after a poor start to the season on their own ground.