Bradford City maintained their League Two promotion bid by beating an Accrington Stanley side now without a win in eight games.
The Bantams went ahead in the first half when Garry Thompson tucked away a knock-down by James Hanson.
An improved Stanley looked like they had earned a point when Rommy Boco levelled from Luke Joyce's free-kick on 79 minutes, but City struck late on.
Kyel Reid crossed for Alan Connell to head home with four minutes to play.
Stanley will be without Dean Winnard for one match after he was sent off for a second bookable offence following a foul on substitute Nahki Wells.