A substitute teacher at an Elizabeth middle school engaged in sexual acts with a student in her car at least twice and exchanged sexually explicit messages with him online, authorities said Friday.

Nataly Lopez, 27, of Elizabeth, was charged with aggravated sexual assault, sexual assault and endangering the welfare of a child, acting Union County Prosecutor Grace Park said.

Lopez taught at Nicholas S. LaCorte-Peterstown School No. 3 through Source4Teachers, a Cherry Hill-based vendor providing substitute teaching services to the schools. She was not a district employee.

Lopez was arrested at her home Thursday afternoon and appeared in court Friday to face her charges, prosecutors said. She will have a detention hearing next week.

Superintendent Olga Hugelmeyer said the district barred Lopez from entering any school immediately after they heard about the allegations.

“Law enforcement and social service agencies were notified, as was the substitute’s employer,” Hugelmeyer said in a statement.

A spokesman for Source4Teachers said the company is cooperating fully with law enforcement and indefinitely blocked the substitute from working in their partner school districts until the police investigation is finished.