"Fucking Catalans, they don't deserve anything," tweeted Juan Carlos Gafo Acevedo on Friday.
The outburst came after spectators at the world aquatics championships, currently being held in Barcelona, whistled in protest during the Spanish national anthem.
Gafo, a former Spanish ambassador in Lebanon, works for the Spanish' government's Brand Spain unit.
The unit is charged with improving Spain's national image and improving investor confidence in the country.
Gafo was initially defiant about his tweet, saying on Saturday he "would never whistle down the Catalan national anthem".
Late on Saturday, however, the official said that while he "felt bad that they (the spectators) had whistled during the Spanish national anthem, he had "nothing against the Catalonia or against the Catalans".
Gafo's outburst caught the Spanish Foreign Ministry, which houses Brand Spain, on the hop, according to Spain's El País newspaper.
But when the country's Foreign Minister José Manuel Garcia-Margallo confirmed the comments had been made, he demanded the official's resignation.
The comments were "intolerable and incompatible with the spirit of Brand Spain" said Garcia-Margallo.
"I apologize to the Catans, and ask for forgiveness," said Gafo in his resignation statement .
"It was an error.
"People who know me, know that I don't think this way."