Anthony Stallard, 24, was seen kicking a football around with a friend in Kingston Cemetery after the pair had been drinking.
He was reported to police, who detained him and charged him with using threatening or abusive words, or behaviour likely to cause distress.
Tim Concannon, prosecuting at Portsmouth Magistrates’ Court, said: “While the football was going on they were shouting and this defendant was effectively singing loudly and being disrespectful in among the graves.
“He was throwing himself backwards, waving his arms about and going ‘wooooooo’. I’m assuming he was pretending to be a ghost.”
Stallard had accepted at an earlier hearing that his behaviour could have been seen to cause distress to grieving relatives, and had pleaded guilty.
Denise Saunders, defending, said: “He has accepted that his behaviour, if it had been outside of a cemetery would not have been inappropriate, but inside a cemetery while people are grieving for their loved ones it might be.
“He is apologetic as demonstrated by his early guilty plea.”
The court was told that Stallard had committed the offence while subject to a 12-month conditional discharge, received for a harassment charge in January.
He was also found to be breaching a suspended sentence for assault, committed in August 2013.
Ms Saunders added that Stallard had complied well with the supervision sentence and was undergoing testing for autism, which she argued could have meant he did not fully comprehend the consequences of his actions.
Stallard was fined £35 and ordered to pay a £20 victim surcharge and £20 court costs.
Three additional months were added to his suspended sentence, which will now run for 15 months.
He will face a 12-week prison sentence if he commits a further offence breaching the suspended sentence.