Suppose that the 1-year spot rate is 1%. This means that a payment of, say, $100 one year from today will have a present value of $100 / 1.01^{1} = $99.0099.

Suppose that the 2-year spot rate is 2%. This means that a payment of, say, $100 two years from today will have a present value of $100 / 1.02^{2} = $96.1169.

Suppose that the 3-year spot rate is 2.5%. This means that a payment of, say, $100 three years from today will have a present value of $100 / 1.025^{3} = $92.8599.

A 3-year, annual pay, 6% coupon, $1,000 par bond will have a value today of:

$60/1.01 + $60/1.02^{2} + $1,060/1.025^{3} = $1,101.39.

That bond has a YTM of 2.4531%, because:

$60/1.024531 + $60/1.024531^{2} + $1,060/1.024531^{3} = $1,101.39.

A spot rate applies to one payment at a given maturity. A YTM applies to all payments at all maturities.