Cody McDonald scored his third goal in four League Two games since re-joining Gillingham on loan to give them victory against Bradford.
The League Cup finalists had started well, with James Hanson heading narrowly over from a Kyel Reid cross.
Gills keeper Stuart Nelson produced a fantastic double save to prevent Gary Jones and Nakhi Wells from scoring.
However McDonald latched onto Deon Burton's lobbed pass and fired home to score the only goal of the game.
VIEW FROM THE DRESSING ROOM
Gillingham striker Cody McDonald told BBC Radio Kent:
"It's great to get on the scoresheet again but credit goes to the lads who had to grind it out today.
"My personal performance wasn't as great as I would like in the first half, but to come here and win isn't easy and it's a massive positive for us.
"You're not going to get loads of chances so it's important you stick some away. Both teams were solid - thankfully I managed to stick mine away.
"Our main aim is to get promoted but once you've done that you want to win the league and go out as winners. Hopefully we can cement that place."