I explore the nature of optimal static and dynamic contracts in an environment with moral hazard, where individuals contracting with the same principal receive correlated productivity shocks. The environment resembles the one considered in relative compensation theory ( i.e tournament theory), but extends this theory by solving for the optimal static and dynamic contracts in this setting. I compute and analyze \emph{independent} (each worker's compensation depends only on her output) and relative contracts (each worker's compensation depends on the xoutputs of all workers contracting with the same principal). Results imply that the optimal static relative contract is not substantially different from the optimal static independent contracts. However, the dynamic relative contract displays a strong a tournament feature; the contract gives the highest compensation to the worker who produces more than her counterparts and the lowest compensation to the least productive worker. I also characterize the stochastic processes for consumption and effort implied by dynamic contracts, and study the age-earnings profiles of the workers.