Gillingham beat winless Oldham to extend their unbeaten start to the season and move top of League Two.
After a feisty first half of few chances the home side took charge after the break.
Kane Drummond missed a golden opportunity at the start of the second half, sending the ball skimming off the top of the crossbar with a header from close range.
Joe Quigley had a couple of decent chances, firing wide from 18 yards with a clear view at the target and then heading tamely into Glenn Morris' hands after a smart Will Sutton cross.
Josh Hawkes also blasted wide when well placed, but Oldham could not convert their dominance into a goal.
They paid the price when Gillingham scored against the run of play in the 74th minute, substitute Sam Vokes racing through a crowd of players to head home Max Clark's corner at the back post.
Morris kept out Tom Conlon's free-kick, Oli Hutton fired into the side-netting and Quigley had a header saved as Oldham's push for a late leveller proved in vain.
Report supplied by PA Media.
Mellon: 'We've got to take the chances'
Ainsworth: 'Good teams find a way'