The basic economic problem is a problem of choice. Wants are unlimited. As soon as one want is satisfied, another is established. Our means of satisfying these wants are unfortunately limited. This is true of the individual consumer in the form of income; the business firm that must choose a profitable good or service to allocate its resources to and is also true of a nation where governments must allocate the resources it receives through taxation. The choice of what wants to satisfy is the basic economic problem.
In an economy, if consumers demand a good or service then its price rises as firms attempt to maximize profits by selling at the higher price. Those firms whose goods or services are not consumed will have a surplus of supply. In a bid to lower this surplus, they lower their prices. Once existing stock is depleted, firms are then able to put their resources into the production of goods or services that are being demanded. In this way an economy can ensure that resources are being used to satisfy wants and attempt to address the economic problem.
Unfortunately, real life economics is more complex then that. If, for example, a good is demanded that leads to the depletion of finite resources or social or environmental damage, then in the long term this may cause other problems (externalities) and may not be the most effective way to solve the economic problem. An example might be coal mining or production processes that cause loss of biodiversity.
Similarly, the price mechanism pre-supposes that everything has a price and will determine how, how much and when something is produced. Unfortunately, public goods such as roads, hospitals, schools, garbage collection and libraries are not supplied by private enterprise because it is hard to target the final consumer and also there is little profit to be made in supplying it. For the price mechanism to be effective it does assume that income is distributed relatively evenly. This is not the case however, and many people are unable to satisfy their needs let alone their wants.
The price mechanism does not solve the basic economic problem but is thought to be effective when operating efficiently. That is, when the forms of failure outlined above can be minimized.