Russia keeper Igor Akinfeev saved Koke's and Iago Aspas' spot kicks in their first ever penalty shootout to send the hosts through.
Iago Aspas scored the only goal against fellow World Cup qualifiers Tunisia seven minutes from the end.
Barcelona's slip-up is a boost for Real Madrid and Atletico Madrid, who can close to within six points with victories over Athletic Bilbao and Real Sociedad respectively later on Saturday.
The attacking midfielder opened the scoring with a brilliant solo goal in the first half and he picked out Spanish forward Iago Aspas for Liverpool's well-taken second shortly after the break.
The Liverpool skipper scored in the first half and Spaniard striker Iago Aspas got home in injury time off some Luis Suarez trickery, to seal a hard-fought win over the two-times A-League champions.
There were appearances for Liverpool's new Belgian goalkeeper Simon Mignolet, signed from Sunderland, while Ivory Coast centre-back Kolo Toure also featured following his arrival from Manchester City.
If the paperwork is completed, Aspas will become Liverpool manager Brendan Rodgers's second signing of the summer following a deal for defender Kolo Toure who was signed from Manchester City.