In linear algebra, Cramer's rule is an explicit formula for the solution of a system of linear equations with as many equations as unknowns, that is, for the solution of a system with a square matrix. In this paper we want to generalize this method for an $m \times n$ system of linear equations, such that $m < n$. We offer a simple and convenient formula for systems with rectangular matrices using only the minors of the augmented matrix, as well as the usual method of Cramer. We also generalize the results in order to solve a matrix equation.