The first step is to examine the composition of your enemy's army. Once you have done that, use the civilopedia to identify the best units/promotions to take them on with. Make rush production (whipping, drafting, buying, or chopping forests for hammers) of these units a priority. Make sure your civics are set up for war. You want all your units to start with at least two promotions. Begin building a lot (and I mean a lot) of siege weapons; these should comprise roughly half your force. If they have a lot of siege weapons, build a number of the proper mounted unit for the period (i.e. if facing cannon, build cavalry) and begin giving them the flanking promotion (these will allow you to flank attack whole stacks of cannon to death).
Try to avoid any major battles until you have a decent size force to counter with; in the meantime fortify a few pairs of defensive units with proper promotions on defensible strategic choke points between your next city and their forces. This will force them to fight their way to you, thus wearing them down and slowing their advance long enough for you to build up your forces.
Once you have enough troops to do the job, you have two option for fighting a pitched battle: defend or counter-attack. You should choose to defend if the next city your enemy is going for is a large fortified city (walls, castle) with a large culture bonus. In this case, you should build up defensive units with city defense and drill promotions. Station troops on defensive strong points (hills, forests) outside the city to prevent the enemy from occupying these. This should result in their forces taking up position on a plains or grassland tile where they will not receive an extra defensive bonus (optimally, they should have to cross a river to get to the city, but this is rarely feasible). Make sure all of your offensive forces are within range of the enemy before initiating the attack. First, unleash your cannons for collateral damage. Next hit them with cavalry given the flanking promotion to target their siege weapons. Finally, send in any offensive foot soldiers you have IF the combat odds favor you winning such attacks. DO NOT use your defensive troops for attacking unless you are absolutely sure you have enough troops to finish the job in one turn (I'm assuming you won't). Instead, keep the defenders in the city and give them the City Garrison promotions. The result of this should be that the enemy throws the tattered remains of its force at you with heavy losses. Either that or they will try to withdraw the survivors. Don't let them! Continue to harass their forces all the way home.
The second option, that of counter-attack, will work better if your next city to be attacked is not well developed, lacks fortifications and has low culture. Here you will sacrifice this small city in order to make it a grave for your enemies. Garrison 20-25% of your army (all strong defensive units) inside the city. Half of these soldiers should be promoted with City Garrison I + II and the other half Drill I + II (reduces collateral damage suffered). Leave the bulk of your troops, including all cavalry and siege weapons, just outside the city on the opposite side from which the attack is coming (make sure they don't have to cross a river to get at the city and can reach the enemy stack in one turn via roads/rails). After the enemy attacks and captures the city, they will have two stacks remaining; one inside the city and the other outside it. Target whichever stack is larger and most damaged utilizing the same attack order of siege weapons, cavalry, foot soldiers outlined above. Chances are the stack remaining outside the city will be the most heavily damaged from having done most of the fighting for the city. Take them out first. If the stack you are attacking is inside the city, give all siege weapons the City Raider promotions to maximize their effectiveness.
Hope that helps. Sorry for the lengthiness.
Cheers