The boy, who is now in Spanish custody, is believed to have spent many hours in the pink, medium-sized polyester suitcase, pressed against a few personal belongings.
"He was shocked when we opened the suitcase to see so many people looking at him," a Spanish police spokesman told CNN. He also said the boy is in good condition.
The police spokesman said police officers in El Tarajal became suspicious when a 21-year-old woman, a Moroccan National, showed signs of nervousness as she attempted to cross the border wheeling the suitcase down the street.
"Our officers asked her if she needed help as the wheels began to give in," the spokesman said.
He was immediately taken to a state child custodian and awaits judicial process, the official said.
A man who is apparently his father, identified as A.O., was arrested a few hours after the boy was found. The man, who has permanent residency in Spain, awaits formal charges.