The previous record high temperature of 40.8 degrees Celsius was recorded on August 7, 2013 in the city.
The red alert for high temperature was issued by the Shanghai Central Meteorological Observatory.
A total of 13 high temperature red alerts have been issued since the new meteorological early warning system was adopted in 2007.
China has a three-tier early warning system for high temperatures: a yellow warning is issued when high temperature above 35 degrees Celsius is predicted for three consecutive days, orange indicates a predicted high temperature of 37 degrees in the next 24 hours and a red alert is issued when the temperature is forecast to reach 40 degrees Celsius within 24 hours.