Police had identified the 17-year-old as the possible culprit in the rape and murder of a 35-year-old woman near the municipality of Colquechaca.
The chief prosecutor says more than 200 furious local people seized Santos Ramos and buried him in the grave of his alleged victim.
He says residents blocked roads into the village to stop police arriving.
A reporter for a local radio station, who would only speak anonymously for fear of reprisals, told the media that Mr Ramos was tied up at the woman’s funeral.
He said mourners threw him into the open grave alongside the woman’s coffin and filled the grave with earth.
Colquechaca is a town of about 5,000 inhabitants some 207 miles ( 333 km) south-east of the Bolivian capital, La Paz.0