Cristiano Ronaldo's 42nd goal of the season prevented Real Madrid from suffering a second successive defeat at the Bernabeu.
Inaki Williams had put Athletic Bilbao ahead with a fine clipped finish.
But Ronaldo, who had earlier hit the crossbar with a header, diverted Luka Modric's shot in with his heel to score his 26th goal in 16 games.
Madrid stay third in La Liga, 15 points behind leaders Barcelona and three points adrift of Atletico in second.
Despite dominating for long periods, it had looked like being a frustrating evening for Zinedine Zidane's team, who squeezed through in the Champions League a week ago despite being beaten at home by Juventus.
Madrid won that quarter-final tie 4-3 on aggregate with a last-minute penalty from Ronaldo.
And the hosts, who had 29 shots on goal, appeared as though they were going to be punished for their profligate finishing, until the Portuguese forward came to their rescue again three minutes from time.