Top Gear presenters, Richard Hammond, Jeremy Clarkson and James May, had characterised Mexicans as lazy and feckless.
The comments enraged hundreds of Mexicans, who contacted the BBC Spanish-language website BBC Mundo to protest, and the matter was also raised in the Mexican senate, where lawmakers were considering a motion of censure.
An all-party group of British MPs also urged the BBC to apologise, calling the remarks "ignorant, derogatory and racist".
The BBC wrote a letter to Mexico's ambassador, Eduardo Medina Mora, saying it was sorry if it had offended some people, but said jokes based on national stereotyping were part of British national humour.
In a statement, the BBC said the comments may have been "rude" and "mischievous", but there was no "vindictiveness" behind them.
"Our own comedians make jokes about the British being terrible cooks and terrible romantics, and we in turn make jokes about the Italians being disorganised and over dramatic, the French being arrogant and the Germans being over-organised," the BBC wrote.
It also added that stereotype-based comedy was allowed within BBC guidelines in programmes where the audience knew they could expect it, as was the case with Top Gear.
"Whilst it may appear offensive to those who have not watched the programme or who are unfamiliar with its humour, the executive producer has made it clear to the ambassador that that was absolutely not the show's intention," the BBC added.
The executive producer of Top Gear also apologised to Mora personally for remarks Clarkson made about him.
Clarkson had said he was confident he would not receive any complaints about their comments because the Mexican ambassador would be asleep. (ANI)