York moved up to third position in the Blue Square Bet Premier table with victory away to Hayes and Yeading.
Jason Walker scored his 15th goal of the season with a curled free-kick from 20 yards and Jon Challinor doubled the visitors' lead with a drilled low shot.
Louie Soares headed Hayes back into it but Patrick McLaughlin's calm finish restored York's two-goal advantage.
Substitute Adriano Moke set up Ashley Chambers for the fourth before Luke Williams' consolation from 20 yards.
VIEWS FROM THE DRESSING ROOM
York City manager Gary Mills told BBC Radio York:
"I thought we were excellent with the football. We've come here, it's not easy and I thought in the first half an hour we were very good.
"We know the down side. We're talking about a team here that scored four goals but we've conceded two.
"We've got to cut them out and we keep talking about that. But as for the other side of it, moving the ball, passing the ball and creating chances, it's a fantastic three points."
Hayes & Yeading 01 Arnold 03 John 05 Cadmore 12 Bentley Booked 24 Ujah Booked 07 Soares 08 Crockford Booked (Lee - 68' ) 10 Williams 23 Mackie (Collins - 46' ) 14 Pacquette 29 Franks (Argent - 80' ) Substitutes 21 Preddie 02 Argent 26 Legg 20 Lee 27 Collins York 24 Ingham 03 Meredith 04 Smith 16 Fyfield 08 Kerr 10 Chambers (Reed - 79' ) 15 Boucaud 20 Challinor Booked 26 McLaughlin (Potts - 87' ) 09 Walker (Moke - 37' ) 17 Blair Booked Substitutes 05 McGurk 06 Parslow 14 Potts 18 Moke 07 Reed
Ref: Steve Martin