Spanish police said late on Thursday that the hijacker was a Mauritanian national. Earlier, the government had indicated that he was Moroccan.
The hijacker was seeking political asylum in Paris, a source close to the Spanish government told AFP, adding that the man had no link to terrorism.
He "wanted to force the pilot to fly to France. He [the pilot] answered that there was not enough fuel," said one airport security official.
The Boeing 737 had landed at a military airport and was immediately surrounded by paramilitary Civil Guard police. Those forces moved in and ended the standoff.
The interior ministry said the Air Mauritania jet had 71 passengers and eight crew members aboard.
The jet was hijacked during an internal flight from the capital Nouakchott to the northern port of Nouadhibou.
"When the pilot landed he deliberately braked very hard. The man fell to the ground and was jumped on by passengers. He fired two bullets but there are no serious injuries," a Mauritanian source said.
A spokeswoman for the Spanish emergency services said 20 people suffered minor cuts and bruises but added she knew of nobody being injured by gunfire, as one emergency services source had reported earlier.
The aircraft had been scheduled to fly on from Nouadhibou to the Spanish Canary Islands.
Police said the jet was initially diverted to Dakhla in Western Sahara for refuelling.