The 27-year-old Spanish national was detained at the hotel at around midnight on Sunday and he faces possible hate crime charges, a spokeswoman for Madrid’s municipal police force said.
Officers were sent to the hotel following a complaint by the managers of the hotel about the racist comments posted online, she added without giving further details.
Spanish media published photos which the man alleged posted to his Instagram which showed several members of Morocco’s squad in the hotel dining room along with racist comments.
The hotel worker reportedly later deleted the posts from his Instagram account and apologised online before he was arrested.
Reports about the online posts sparked outrage in Morocco, which earlier this month joined Spain and Portugal in a bid to host the 2030 World Cup.
Morocco will face Peru in a friendly match on Tuesday at Atletico Madrid’s Metropolitano stadium.