We present a new technique for constructing solutions of quasilinear systems of first-order partial differential equations, in particular inhomogeneous ones. A generalization of the Riemann invariants method to the case of inhomogeneous hyperbolic and elliptic systems is formulated. The algebraization of these systems enables us to construct certain classes of solutions for which the matrix of derivatives of the unknown functions is expressible in terms of special orthogonal matrices. These solutions can be interpreted as nonlinear superpositions of k waves (or k modes) in the case of hyperbolic (or elliptic) systems, respectively. Theoretical considerations are illustrated by several examples of inhomogeneous hydrodynamic-type equations which allow us to construct solitonlike solutions (bump and kinks) and multiwave (mode) solutions.