Iker Muniain gave Athletic a deserved lead in the 32nd minute by bundling the ball home after Real failed to get back in time to defend a counterattack.
The home side had a slew of chances during an entertaining, end-to-end first half, while Real were twice denied by Athletic's impressive 21-year-old goalkeeper Unai Simon.
The visitors finally beat the youngster when Isco nodded home a cross from Gareth Bale in the 63rd minute as the visitors improved after bringing on midfield anchor Casemiro at the start of the second half.
Simon made two more outstanding saves to thwart Marco Asensio and Sergio Ramos although Athletic continued to counter, Inaki Williams smashing wide and the Basques being denied a penalty when the ball struck Casemiro on the arm while the Brazilian was on the floor.
The decision enraged Athletic supporters in a hostile atmosphere at San Mames, which was mirrored on the pitch as referee Jose Luis Gonzalez Gonzalez handed out eight yellow cards, six to Athletic players.
Real are second in the La Liga standings with 10 points after four games. Champions Barcelona, on 12, came from behind to win 2-1 at Real Sociedad earlier on Saturday.