Mexico's government has accused Bolivian police of blocking Spanish officials from leaving the Mexican ambassador's residence on Friday, deepening a growing diplomatic row between the two countries.

Two Spanish diplomats were about to leave the Mexican ambassador's residence in La Paz when they were told their cars had been detained some minutes away and would not be allowed to re-enter the compound, Mexico's foreign ministry said in a statement.

Karen Longaric, Bolivia's foreign minister, complained that Spanish diplomats were accompanied by masked and armed men on a visit to the residence, calling that an abuse of Bolivia's sovereignty. She said a protest would be lodged with the European Union, United Nations and Organization of American States.

Television stations broadcast images of a masked person getting out of a Spanish diplomatic vehicle and exchanging words with local police. Civilians then approached and began attacking the car, shouting that there could be an attempt to free nine officials sheltered inside.

Mexico says Bolivian authorities have harassed and intimidated its diplomatic staff in a row that erupted over the Mexican government's decision to grant asylum to nine people, now housed in its diplomatic facilities in La Paz. Some of them are wanted by Bolivia's new conservative administration.