BARCELONA, SPAIN -- An F-18 fighter jet crashed at an airbase in the Spanish city of Zaragoza but the pilot ejected successfully, the Spanish defense ministry said Saturday.
The aircraft landed within the perimeter of the base, the defense ministry said on Twitter.
The base, which is about 10 miles (16 kilometers) outside the city, belongs to the Spanish Air and Space Force.
Videos posted on social media showed a plane in flames falling towards the ground.
The air force said several hours after the crash that the pilot was "recovering favorably" but would remain in the hospital under observation for "a few days."
Spain's public news agency EFE said the F-18 was training for a flying exhibition when the crash occurred.
The Guardia Civil told The Associated Press that one of its patrols was the first to reach the pilot, who fell outside the exterior fence surrounding the airbase.
According to the Guardia Civil, the pilot suffered injuries to his legs, apparently because he ejected with a parachute from a low altitude. He was evacuated to hospital in a helicopter.
The Guardia Civil said it would collaborate with the military in investigating the crash. It said that the initial information provided by the pilot was that the plane had apparently suffered a malfunction.
The American-made F-18 Hornet has formed a part of the air defenses of the United States since the 1980s and has been purchased by the air forces of several allied countries.
Spain's air force acquired its first 72 models of F-18 manufactured by McDonnell Douglas in 1983. The fighters, known for their versatility, entered service three years later. Spain's air force later purchased an unspecified number of additional F-18s.
The Zaragoza base is home to a unit of Spain's F-18s.
Spain's defense ministry did not immediately respond to questions by the AP about crash.