Quantum phase transitions occur when the ground state of a quantum system undergoes a qualitative change when an external control parameter reaches a critical value. Here, we demonstrate a technique for studying quantum systems undergoing a phase transition by coupling the system to a probe qubit. It uses directly the increased sensibility of the quantum system to perturbations when it is close to a critical point. Using an NMR quantum simulator, we demonstrate this measurement technique for two different types of quantum phase transitions in an Ising spin chain.