Let's start by setting up an equation that expresses all the information we've been given in the word problem. We're given the total travel time (13 hours) as well as the distances for the two sections of the trip (245 and 240 miles). We can think of the total time as the sum of two section times, each of which is calculated as the quotient of distance and speed. That is:
13 = 245/x + 240/(x+5),
Where x is the original speed. Our task is to solve for x.
In order to do this, we convert the equation to a quadratic by multiplying by the denominators:
(13)(x)(x+5) = (245/x)(x)(x+5) + (240/(x+5))(x)(x+5)
13x2 + 65x = 245x + 1225 + 240x
13x2 - 420x - 1225 = 0
Factoring gives us
(13x + 35)(x - 35) = 0
Since we obviously aren't concerned with negative answers, the only relevant solution is x = 35.
So the speed for the first leg of the trip is 35 mph, and the speed for the second leg is x + 5 = 40 mph.