Royal Air Maroc officials said the 39-year-old woman informed the flight crew that she was feeling contractions Sunday during the flight from Casablanca, Morocco, to Bologna, Italy, Thinkspain reported Wednesday.
A midwife who happened to be traveling on the same plane tended to the woman while the crew prepared for an emergency landing at El Prat airport in Barcelona.
The woman's newborn son arrived just moments before the plane touched down, officials said.
The mother and newborn were taken to Barcelona's Sant Joan de Deu hospital.
The plane continued on its way to Bologna after about 50 minutes in Barcelona.