Emergency workers said the fire broke out in the abandoned building which had no running water and electricity early in the morning.
"Six people died from smoke inhalation and one person died after he jumped out of the building try to escape," said Johannesburg Emergency Management Services spokeswoman Nana Radebe.
She said 50 people were rescued from the blaze, seven of them requiring hospitalisation for burns and smoke inhalation treatment.
Illegal occupation of disused buildings in the city is a widespread problem, with many building said to be under the control of criminal syndicates who collect rent from occupants.
According to city officials, over 300,000 people around the Johannesburg metro area were on the waiting list for government subsidised homes.
Follow NDTV for latest election news and live coverage of assembly elections 2019 in Maharashtra and Haryana.
Subscribe to our YouTube channel, like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.