The Shaymen had the better of the opening quarter with Nigel Jemson having a shot saved by Railway keeper Jordan Yorath who also smothered an Ashley Stott effort.
And they took the lead after 20 minutes when Paul Evans played the ball in with his ri
ght foot from the left and Adams rose to head home.
Stott was denied again by Yorath just before the half hour mark but the Shaymen doubled their lead in the 31st minute when Mark Peers crossed from the left and Barnes volleyed home at the far post.
Jemson flicked an Evans corner over the bar early in the second half and Adams was unable to connect with an Evans free kick as Town looked for more.
But Railway showed more ambition with Will Ryder flashing an effort narrowly wide before they pulled a goal back in the 65th minute, James Riley heading home a David Henry corner.
Scott Jackson then went close twice with shots on the turn as Town struggled to re-impose themselves on the game and Ben Jones had a goal disallowed for a foul on John kennedy.
David Brown's shot across goal in the 78th minute after he had broken clear was a rare Town attack.