By definition, opportunity cost is the cost of the next alternative that you gave up because you choose another one. In this case, there are two alternatives: the closer gas station and the farther gas station. Because you chose the cheaper but farther gas station, then the opportunity cost is $2.50 for the closer gas station.