Barcelona were beaten in their opening match of 2017 as Athletic Bilbao won a feisty Copa del Rey last-16 first leg at San Mames 2-1.

Two goals in four first-half minutes - from Aritz Aduriz and Inaki Williams - gave Athletic a 2-0 half-time lead. Lionel Messi netted a free-kick seven minutes into the second half and hit the post with the last act of the game as the hosts withstood a Barca bombardment despite being reduced to nine men.

Raul Garcia was sent off for two bookable offences and Ander Iturraspe followed late on, but Aduriz avoided punishment despite appearing to catch Samuel Umtiti in the throat at a corner.

The second leg takes place at the Nou Camp next Wednesday, when Luis Enrique's holders will have to overturn a deficit if they are to keep alive hopes of a record 29th Copa del Rey crown.

Inaki Williams found the net with a fine strike minutes after Aduriz's opener (Getty)

Ernesto Valverde's Athletic played with high intensity from the start, pressing Barca and trying to force errors. Mikel San Jose headed wide from an early corner, but the best early chance fell to Gerard Pique, who nodded wide from Messi's cross.

Los Leones took the lead when Garcia and Aduriz exchanged passes. The striker continued his run and beat Marc-Andre ter Stegen with a glancing header.

Athletic were not content to sit back on their lead and gained their rewards when Williams found the net with a fine strike.

Barca tried to respond before the break but Umtiti had a shot blocked and Messi was denied by Gorka Iraizoz. The visitors twice appealed for penalties in first-half stoppage time, first for a challenge on Neymar and then for one on Luis Suarez, but their calls were dismissed.

Garcia fouled Neymar early in the second half, presenting Messi with an opportunity, and the Argentina playmaker curled in the free-kick from the left, the ball bouncing down off the crossbar and crossing the line.

Lionel Messi curled in a free-kick, the ball bouncing in off the crossbar (Getty)

Garcia received his first booking for a foul on Messi and was sent off 20 minutes later, receiving a second yellow for a late challenge on Neymar.

Athletic were under pressure and Messi tried to make the most of his side's numerical advantage, but was narrowly denied a shooting opportunity.

Iturraspe joined Garcia in being sent off following a foul on Neymar. Suarez's attempted lob of Iraizoz failed before Messi hit the post late on as Barca's bid to bounce back fell short.