A statement issued by Tanzanian ministry of foreign affairs and international cooperation said Nwairat shot himself to death in his office, Xinhua reported.
"Information we have received from the Libyan embassy said Nwairat shot himself in the left side of his chest in the afternoon on Tuesday while he was in his office," said the statement issued by the ministry's spokesperson Mkumbwa Ally.
The statement said on hearing the gun shot, officers at the embassy broke the door of the diplomat's office and found him lying in a pool of blood.
"They rushed the diplomat to AMI Hospital in Oysterbay where he was pronounced dead," the statement said, adding that police have confirmed the death.
The statement said that the Libyan embassy was making arrangements to ferry the body of Nwairat to Libya for burial.
Suleiman Kova, the regional police commander for the Dar es Salaam special zone, confirmed the death of the diplomat, saying police have started investigating the incident.