As a trader, you'll be looking to buy or sell at the narrowest possible spread – in other words, when the bid and ask prices are close together. Let's look at why:
Imagine you buy the asset shown in this diagram at an ask price of 1.2873.
If you were to sell again instantly, you'd do so at only 1.2872. This means you need the market to rise by one point (the size of the spread) just to break even on your trade.
If the bid price overtakes the price at which you bought, you're on the road to profit. In this example, the bid price rises from 1.2872 to 1.2875 (three points), so your gain is based on a two-point movement.
An asset's liquidity, or the ease with which it can be traded in the market, is the key factor that determines the spread.
The reason is that if more traders want to buy and sell, more bids and asks are posted – increasing the likelihood that the lowest selling price and the highest buying price will converge.
Of course, the spread is also affected by the size of any dealing fees it includes. Fees generally rise when a market is illiquid, to compensate the market maker in case it can't immediately find a party to take the other side of your trade. That's another reason why liquid markets mean smaller spreads.
Lastly, it's worth noting that in OTC markets such as forex, where you don't have to deal through a centralised exchange, an array of different bid/ask prices are usually available for a given asset at any particular time.
You may have already noticed this when buying currency for foreign travel – different rates appear on the boards in various foreign exchange bureaux.
So if you wanted to trade GBP/USD, for example, you could shop around the different forex dealers to find the best quote for the pair. This is in contrast to trading an asset like an exchange-listed share, which is available at a uniform value – the only cost difference being in the various stockbrokers' own fees.