The microstructure and the superconducting properties of YBa2Cu3O7-x thin films prepared by plasma-enhanced metalorganic chemical vapor deposition have been investigated systematically as a function of metal composition. Yttria precipitates are not apparent on the surface of yttrium-rich films. They are densely distributed within the films, their average size is of the order of 5-10 nm and their density can be as high as 10(24)/m3. Excess copper leads to the precipitation of copper oxide (CuO) particles on the surface of the films, but they are not found in the bulk. High transition temperatures and high critical current densities have been obtained over a wide range of compositions. Transition temperatures higher than 86 K are always obtained when the Cu/Ba ratio is larger than the stoichiometric ratio of 1.5. Films with Cu/Ba ratio larger than 1.5 and a Ba/Y ratio less than 1.7 usually have a critical current density larger than 10(6) A/cm2 at 77 K and 0 T. The dependence of the critical current density on temperature follows a power law, J(c)=A (1 - T/T(c))n. The value of n is 2 for stoichiometric and barium-rich films and 1 for yttrium-rich films. The best films with transition temperatures of 90K, critical current densities in excess of 10(6) A/cm2 at 77.5 K, and smooth surfaces are observed when the Ba/Y ratio is around 1.6 and the Cu/Ba ratio is around 1.8.