The Chelsea captain, John Terry, has denied racially abusing Queens Park Rangers's Anton Ferdinand, admitting that he used racist and offensive language but arguing that he only did so "sarcastically".

Terry, 31, shouted "fuck off, fuck off ... fucking black cunt, fucking knobhead", at Ferdinand, 27, after being "goaded" by the QPR defender over an alleged affair with a "team-mate's missus", during the heated incident at Loftus Road, Westminster magistrates court heard.

Terry did not deny using the racist language during the match on 23 October 2011, which was shown on television pictures broadcast to millions worldwide.

Terry's case is the words were "uttered by way of sarcastic exclamation" in relation to a "perceived false accusation made by Mr Ferdinand to the effect that he, the defendant, had used the term 'black cunt'," said Duncan Perry, prosecuting.

Terry denies a racially aggravated public order offence.

The prosecution claimed that far from Terry repeating the insult with "exaggerated sarcasm", Terry's words were uttered as "an abusive insult demonstrating hostility based on Mr Ferdinand's membership of a racial group".

Ferdinand, giving evidence, said he had not realised what Terry had said until after the match when the QPR centre-half's then girlfriend showed him YouTube footage on her BlackBerry.

"It was very hurtful," and had he heard it at the time, he would have told officials, he said.

He added being called "a cunt" was fine, "but when someone brings your colour into it, it takes it to another level and it's very hurtful".

The court heard Chelsea were down to nine men when Terry and Ferdinand began trading insults over a penalty claim.

As Terry sat in the glass-panelled dock, Ferdinand, stood in the witness box opposite, said: "He called me a cunt, and I called him a cunt back and he gave me a gesture as if to say my breath smelled."

"I said to him 'How can you call me a cunt? You shagged your team-mates missus, you're a cunt," he added, a reference to Terry's alleged affair with Wayne Bridge's ex-girlfriend Vanessa Perroncel. As he jogged away, Ferdinand said he made a gesture – described in court as a "slow fist pump" and indicating sex.

After the match, Ferdinand said Ashley Cole, Chelsea left back, told him he could not "talk to JT like that".

Ferdinand said Terry asked him to go to the Chelsea dressing room. He said Terry asked him: "Do you think I racially abused you? I was like 'No. That never came out of my mouth'". Cole popped his head round and said: "Yeah, didn't you say that to me?", said Ferdinand. "I said 'I didn't say that at all".

Ferdinand added he and Terry agreed it was "just handbags" – or banter – and shook hands.

But later, at about 7pm, he saw the video footage on his girlfriend's BlackBerry.

Cross examining Ferdinand, George Carter-Stephenson QC, for Terry, asked if he was "trying to get a rise out of Mr Terry" to get him to react on the pitch. Ferdinand replied: "Probably, yes."

But he denied suggestions he decided to "up it" and add the racial allegations because Terry was not responding to his taunts. He also denied he had gone into the dressing room because he "felt guilty" about the allegations he had made.

Examining footage, some of it broadcast on the day and some unbroadcast, Carter-Stephenson said Ferdinand must have been sworn at and "been called a fucking knobhead" many times on the pitch. "Yes," replied Ferdinand.

Asked why he was "reluctant" to involve police, Ferdinand said he had wanted it to be "dealt with by the FA" as it happened on the pitch. He had "no reason" to make up the allegation or add a racial element to provoke Terry, he said.

Carter-Stephenson claimed Ferdinand's agent Justin Rigby said there was a fear that if no further action was taken, black footballers would see it as "a white man's word against a black man's word". He alleged Ferdinand decided to go to the police only when Rigby persuaded him to, a claim denied by the player.

In a statement made to police last November, Terry said he was offended by the accusation that he had used racist language.

It read: "While footballers are used to industrial language, using racist terms is completely unacceptable whatever [the] situation.

"I was completely taken aback by this remark as I have never been accused of something like that and I did not take this remark lightly at all, and took strong offence to his suggestion."

Susan Whitewood, a lip reader, told the court she examined footage and thought Ferdinand said "Oi, you," then his head was obscured by the referee, followed by "shagging your mate's missus", and then another word she could not make out.

She said she believed she could see Terry saying: "Yeah, I [missing word and face obstructed] you fucking black cunt [pause] fucking knobhead", she said.

Challenged by the defence over whether "you" could be "a", she agreed it was possible, but she was of the opinion it was the word "you".

The case continues.