Australian scrum-half Hastings touched down in the 14th minute to open the scoring after the Warriors had failed to register a try in their previous two outings.
Marshall crossed the line on the hour and Gildart added a third before Singleton added a fourth late on to complete a comprehensive win over a Castleford side who struggled badly in attack.
The Tigers had won their last five home meetings with Wigan, whose previous visit at Wheldon Road was a 33-26 success on May 26, 2016.
Wigan led when England forward John Bateman was denied just short of the line by Castleford.
On the next tackle, however, Hastings showed impressive strength to barge over the line and half-back Harry Smith added the conversion to make it 6-0.
Hastings’ try lifted Wigan and they went in search of a second when second-rower Liam Farrell embarked on a weaving run inside the left channel only to see his progress halted.
Castleford threatened in the 18th minute but Jordan Turner, whose two tries helped secure victory at Hull FC last Thursday, could not take Niall Evalds’ pass in his stride and the opportunity was spurned.
Yet the hosts continued to probe and Wigan were forced to defend doggedly as the first half wore on.
The Tigers pushed hard for their first try but their last-tackle plays were below par and the Warriors held firm to lead 6-0 at the break.
Two minutes before half-time, Castleford had second-rower Jesse Sene-Lefao sin-binned for a high shot on Wigan prop Joe Bullock.
Immediately after the restart, referee James Child showed a yellow card to Wigan forward Liam Byrne for a tackle on Nathan Massey.
Castleford then forced their visitors into two goal-line drop-outs in quick succession but Wigan then began to enjoy a period of pressure at the other end of the field.
The Tigers replaced scrum-half Gareth O’Brien with winger Greg Eden, a move that saw Turner move into the halves alongside Richardson.
But in the 60th minute, Wigan made the game safe when Turner’s pass fell kindly to Marshall midway through the Castleford half.
Wigan winger Marshall collected the ball and raced clear from deep to score a try which Smith converted to double his side’s lead.
With 12 minutes remaining, Smith’s superb pass found Gildart arriving in the left corner and he could not be stopped as he powered over the line for a third Wigan try.
Singleton then touched down from close range in the final minute and Hastings converted to cap a fine win.