Barcelona advance in Copa after tight win