Quantum criticality emerges when a many-body system is in the proximity of a continuous phase transition that is driven by quantum fluctuations. In the quantum critical regime, exotic, yet universal properties are anticipated; ultracold atoms provide a clean system to test these predictions. We report the observation of quantum criticality with two-dimensional Bose gases in optical lattices. On the basis of in situ density measurements, we observe scaling behavior of the equation of state at low temperatures, locate the quantum critical point, and constrain the critical exponents. We observe a finite critical entropy per particle that carries a weak dependence on the atomic interaction strength. Our experiment provides a prototypical method to study quantum criticality with ultracold atoms.