The predawn attack in the governorate of Jendouba left two other people wounded.
The Tunisian Ministry of Interior said in a written statement that four "terrorist element" gunmen stopped the prison official's car Sunday morning and killed him and a civilian. Two police officers responding to the gunfire were also shot dead. Two other passengers in the car were wounded.
The identities of the victims were not immediately identified.
Tunisia Live said the attack was the latest incident in a wave of violence that has roiled the North African nation since the government was overthrown in 2011.