The defeat shut the door to the Cup quarterfinals for Real as the Primera Liga leaders had lost the last 16 first leg 2-1 last week. Real dominated the match but missed a host of chances after starting with a second-string side, and Argentine midfielder ArielIbagaza scored the only goal seven minutes from time at the Bernabeu.
Mallorca will meet last season's finalists Getafe in the quarterfinals. Getafe beat the league's bottom club Levante 4-0 on aggregate.
In other last 16 clashes, Villarreal got past Recreativo Huelvawith a 2-0 extra time home win to aggregate a 2-1 victory. They will next face Barcelona, which knocked out holders Sevilla on Tuesday.
Atletico Madrid drew 1-1 at Valladolid and to set up a quarterfinal encounter with Valencia, who overcame Real Betis 4-2 on aggregate with a comfortable 2-1 home win.
Racing Santander earned a 4-2 comeback win over Zaragoza at home to earn a 5-3 aggregate victory. They meet 23-times Cup winners Athletic Bilbao who beat the 2006 winners Espanyol on penalties.