As the price mechanism determines what consumers spend their money on it also determines how scarce resources are allocated (used). Prices have three seperate functions: rationing, signalling and incentive functions. These ensure collectively that resources are allocated correctly by co-ordinating the buying and selling decisions in the market.
Below is a diagram to illustrate how the price mechanism works in a supply and demand framework. In this instance, an increase in demand for a product forces producers to produce more of the product due to the higher profit incentives. This is because the excess demand (from a positive demand shift) forces the price up and therefore the producer knows that for selling each product they will receive a higher average level of revenue per unit. Therefore the higher demand is signalling to individuals to allocate more resources to producing this type of good.
So in summary prices serve to ration scarce resources particuarly when a disequilibrium exists. If there is excess demand, the price increases - forcing only the consumers who have the absolute desire and willingness to purchase the product. This often occurs for goods such as sporting tickets, where there is a limited supply but high demand.