The country’s Vice President Samia Suluhu Hassan confirmed his death in a statement delivered on live television.
Mr Magufuli had not been seen in public for two weeks, and died in a hospital in the city of Dar Es Salaam.
Police in the east African nation have been arresting people in recent days for spreading reports the president was seriously ill.
“There are a lot more who have been spreading false statements,” Police Commissioner for Kinondoni Ramadhani Kingai said at a press conference on Saturday.
“We will arrest them all.”
He also cast aspersions on the country’s coronavirus testing program, claiming that he sent samples of papaya and goat to the facility and they came back positive.
He also discouraged the wearing of masks.
Tanzania stopped reporting coronavirus figures in May last year.
Before being elected to parliament and then the presidency, Mr Magufuli was a high school teacher and an industrial chemist.
Popular in Tanzania for his anti-corruption efforts, he was also accused of autocratic tendencies, persecuting critics and members of the opposition.
Ms Hassan has now become Tanzania’s first female president.