The mathematical method of investigation of the process of crystallization of a molten metal in a two-dimensional mold has been developed using the variational formulation of the problem with determination of the velocity of motion of the crystallization front and the solidified-metal thickness at any instant of time.