A win in the decisive doubles rubber saw Romania edge past Spain and into the World Group play-offs.
Romania have now won 6 consecutive Fed Cup ties and the first round started as expected when Simona Halep eased past Silvia Soler-Espinosa 62 61 in the opening rubber.
Garbine Muguruza, making her Fed Cup debut, levelled the tie with a 63 62 win over Irina-Camelia Begu. Muguruza then caused a shock when she defeated Halep in the third singles rubber 64 63 to put Spain 2-1 ahead.
Begu made it 2-2 with a 62 64 win over Soler-Espinosa and force the deciding doubles. Begu teamed up with Monica Niculescu to defeat Muguruza and Anabel Medina Garrigues 57 63 62.