Variable X-ray sources represent some of the most extreme physical phenomena in the Universe and provide probes of intense magnetic fields, strong gravitational fields, and extremely high temperatures. The types of objects that display variable X-ray emission include stars, accreting compact objects (black holes, neutron stars, and white dwarfs), and even planets. The type of X-ray variability observed can be broadly grouped into explosive (flaring), periodic, and aperiodic variability. The shape of the X-ray spectrum and the variability properties of a given source can provide information on the underlying physical mechanism of the X-ray emission and therefore the nature of the source. I will present a study of the 2,267 variable X-ray sources in the XMM-Newton 2XMMi-DR2 catalogue, highlighting some interesting results regarding the spectral and timing properties of different source populations. I will also discuss recent work investigating the use of machine learning techniques in the automatic classification of the variable X-ray sources in 2XMM. Such techniques have been found to be highly successful in identifying unknown objects. They therefore have important implications for the automatic classification of astrophysical sources detected in large sky surveys such as those to be performed by the MWA, ASKAP, SkyMapper, and eROSITA telescopes.