Iker Muniain came home from close range to give Athletic a first-half lead in San Mames. Unai Simon impressed the hosts.
But Toni Kroos sent Gareth Bale in the lead with an excellent chip pass and Isco hit Wales's 1-0 cross.
Madrid pushed for victory, but could not beat Simon a second time. Lopetegui's men were two points behind leaders Barcelona, who claimed their perfect record.
Inaki Williams scored a shot on 14 minutes and Markel Susaeta narrowly scored a 20-yard lead before Thibaut Courtois scored twice as Athletic made a high-class start.
Simon rescued Marco Asensio, but Athletic took the lead in the 32nd minute.
Susaeta came into the Madrid box and the captain's low cross was credited from close range by a combination of Williams and Muniain, the latter with the goal.
Athletic were suspended because of an offside when Raul Garcia parried a Benat free-kick. Simon was back in action when he turned off to the right and defended Luka Modric.
Simon was lucky that Bares was able to parry a free-kick, but the 21-year-old made a splendid save to keep Sergio Ramos from bouncing off the rebels.
Lopetegui unleashed Isco and the Spanish star equalized within three minutes. He marked Bale's ball with an excellent right-back as he scored the deserved finish.
But Simon fired a shot from Asensio perfectly in the 68th minute to save one point for Athletic. Neither side could find a winner in a hectic finale.
What does it mean: Early advantage for Barcelona
Following the bitter loss of city rivals Atletico Madrid in the UEFA Super Cup, Madrid have played well under coach Lopetegui. But here was something missing, perhaps the X-factor that the talisman Cristiano Ronaldo had previously given. A two-point gap seems to make little headway at this stage of the season, but defending champion Barca is in ominous form.
Pat on the back: Simon is a star in the making
Athletic received a world goal fee for a goalkeeper when they sold Kepa Arrizabalaga to Chelsea, but they may have a ready-made replacement. Simon was only his fourth appearance in the Primera División, but he showed a brilliant performance, his fighting stance as well as his reflexes.
Raise the back: Benzema dull
After the change from Ronaldo to Juventus Karim Benzema is initially confident. He had already scored four goals this season, but played poorly in San Mames and offered no point of attack. Captain Ramos did not seem impressed.
Key Opta statistics:
– Isco scored the second fastest goal of a substitute in Primera División this season (two minutes and 52 seconds), after Juanmi beat Villarreal (two minutes and 33 seconds) from Real Sociedad.
– Iker Muniain scored his first goal in the Spanish league against Real Madrid on his 14th appearance.
– Athletic won their last 18 league games against Real Madrid (D4 L13) in March 2015.
– Gareth Bale was involved in all competitions this season with 46.1 percent of Real Madrid's goals (three goals and three assists).
It will be the next UEFA Champions League match for the men of Lopetegui who host Rome on Wednesday night (Thursday morning AEST) before Espanyol is greeted three days later in the capital LaLiga. Athletic will join Real Betis this coming weekend.