MADRID -- Huesca will play in La Liga for the first time in the club's history next season.
The small club from northeastern Spain secured the historic promotion by beating Lugo 2-0 on Monday.
The victory guaranteed Huesca at least second place with two matches left in the 22-team Segunda division.
Huesca came close to making it to the first division last season but they were eliminated in the promotion playoffs.
They have been in the second division since 2015.
"We fought hard for this, it's well-deserved," said Alex Gallar, who scored one of Huesca's goals on Monday. "I can't believe it. Huesca is a first-division team. It's historic. It's time to celebrate."
Malaga, Deportivo La Coruna and Las Palmas were the teams relegated to the second division from La Liga this season.