Deprived of seven key players through injury, Barca coach Xavi Hernandez was forced to turn to his youngsters and 19-year-olds Nico Gonzalez and Abdessamad Ezzalzouli both scored as the visitors twice took the lead.
But Osasuna levelled first through defender David Garcia and then almost in stoppage time, through a low shot from Avila from outside the box that deflected in off Samuel Umtiti’s right foot.
Barcelona are eighth in the table, still outside the European qualification places and 15 points off leaders Real Madrid.