forward contract net/gain loss on position

I’m working through some of the practice problems in reading 62 in the CFA institute textbook for derivatives…when you enter into a forward contract to buy or sell an asset, are you buying or selling that asset at the spot price at initiation of the contract or the spot price at expiration of the contract? If buying/selling at spot price at expiration, what’s the point of a forward contract in the first place? What exactly are you locking in? Thank you.

you are buying or selling spot at the forward price at contract maturity. if the spot price is higher than the forward price and you are long, you are making money because buy spot under market price.