When you place a market order, though execution is guaranteed, there are chances that the order gets executed at a “freak” price, i.e. a price far away from the current market price. This is because:
The bid/ask spread for the stock is too high
The stock has extremely low liquidity
Hence, a large order with an outlier price in an illiquid security will push the market price far away from the current price, resulting in huge losses for investors placing market orders.
A limit order, on the other hand, does not guarantee execution, nonetheless, it saves the investors from significant adverse price movements.
If you place a limit order, in such a way that the market price is already at or better than the limit price, you can get an immediate execution, while protecting yourself against an execution at a price significantly away from the current market price.
For Example -
The Current Market Price for Reliance Industries Ltd is Rs. 2500
You place a limit buy order with the price defined as Rs. 2525
Since the market price is already lower than the limit price, the order will start getting executed at the market price of Rs. 2500
If a large order comes in the market which shoots the market price up to Rs. 2550, the remaining quantity will not get executed since the limit price is defined as Rs. 2525. There will be no execution beyond the defined limit price of Rs. 2525.
Thus, you got an immediate guaranteed execution at a market price of Rs. 2500, while you also protected yourself against a freak execution due to an adverse price movement, since the order did not get executed beyond the limit price of Rs 2525.