We develop a theory of magnetoresistance of two-dimensional electron systems in a smooth disorder potential in the hydrodynamic regime. Our theory applies to two-dimensional semiconductor structures with strongly correlated carriers when the mean free path due to electron-electron collisions is sufficiently short. The dominant contribution to magnetoresistance arises from the modification of the flow pattern by the Lorentz force, rather than the magnetic field dependence of the kinetic coefficients of the electron liquid. The resulting magnetoresistance is positive and quadratic at weak fields. Although the resistivity is governed by both viscosity and thermal conductivity of the electron fluid, the magnetoresistance is controlled by the viscosity only. This enables extraction of viscosity of the electron liquid from magnetotransport measurements.