Joy’s law describes the tilt of predominantly east-west aligned bipolar active regions on the Sun, where the flux of the polarity concentrated at the prograde side tends to be closer to the equator than the following polarity. The tilt of solar active regions described by Joy's law is an integral component of Babcock-Leighton dynamo models for converting a toroidal field to a poloidal field, and is attributed to the Coriolis force due to an observed increase in tilt angle at higher latitudes. This tilt plays a crucial role in some solar dynamo models. Recent results have shown that Joy’s law sets in during the emergence process, suggesting it is a near-surface effect. Our goal is to measure the induced tilt angle of a flux tube as it rises through the upper convection zone just below the solar surface. On the Sun, Joy's law is weak and is only evident as an average over many active regions. To achieve a measurable effect in a single simulation, we consider a rotation rate approximately 100  times faster than the Sun using a three-dimensional Cartesian magnetohydrodynamic simulation of a flux tube ascending from a depth of 11 Mm. The simulation shows that the flux tube emerges at the surface with a tilt angle consistent with Joy’s law when scaled to the Sun's slower rotation, and the tilt angle does not substantially change after emergence. This shows that the Coriolis force acting on flows horizontal to the surface within the near-surface convection zone is sufficient to explain Joy’s law.