The road south to Peru passes right by Machala and heads down through Santa Rosa and Arenillas to the border town of Huaquillas, some 80km (50 miles) south of Machala. If you're going on to Peru, you should definitely use Machala, or even Guayaquil, as your final base in Ecuador because there are very limited services and no accommodations that I can recommend in Huaquillas. The Río Zarumilla forms the physical border between the two countries, and the Peruvian border town is Aguas Verdes. Keep in mind that the Ecuadorean immigration control point is located about 3.2km (2 miles) north of the actual border crossing, while its Peruvian counterpart is about 2km (1 1/4 miles) south of the river. Both are on the main road and readily identified by numerous signs.
If you are planning on traveling from Ecuador to Peru, I recommend you buy a through ticket on a reputable bus line, as the border crossing here is quite rough, and I've received various reports of attacks and robberies against tourists both on the ground here and on cheaper local buses. Through tickets to Peru are sold by several bus lines in Quito, Guayaquil, Cuenca, Loja, and Machala.
Note: The border is a hectic mess on both sides, and is relatively dangerous for travelers. Peru and Ecuador have had border disputes in the past, which hasn't helped matters. Keep a careful eye on your belongings, and be wary of hucksters and scam artists. Try to avoid and discourage touts. Scores of individuals offer money exchange in the streets on either side of the border, but I recommend exchanging a minimal amount there, because these dealers often give unfavorable rates, use rigged calculators, and pawn off counterfeit bills. It's best to have a good grasp of the current official exchange rate ($1 was equivalent to 2.99 soles, and £1 was equivalent to 4.48 soles, at press time), and to see if you can exchange dollars for Peruvian soles at a bank in Machala. If not, exchange what you need to get you through to Tumbes or a bit beyond, where you'll find more reputable and less risky exchange houses.
Note: This information was accurate when it was published, but can change without notice. Please be sure to confirm all rates and details directly with the companies in question before planning your trip.