To calculate a global average temperature, scientists begin with temperature measurements taken at locations around the globe. Because their goal is to track changes in temperature, measurements are converted from direct temperature readings to temperature anomalies—values that represent the difference between the observed temperature and the long-term average temperature for each location and date.
You can read the whole thing here:
https://www.climate.gov/news-features/understanding-climate/climate-change-global-temperature