What really happens when you enter a portal in minecraft? (Or should I say, when you come back?)
Solution 1:
The portal spawning algorithms have gone though a lot of changes to get to the point they are now, and it used to be the case that you'd end up miles from your base when this happened but Notch linked them properly so hopping back in your Nether portal should take you right back to where you came from. As with everything Minecraft, this is not a guarantee however!
As StrixVaria said, carrying a compass is vital to helping you get back from any expedition but this does point to your spawn, not your base.
Solution 2:
The compass sprite always points towards your spawn location. As long as you know how to get to your base from your spawn, you can use the compass to find your way home. Put the compass on your quick items bar at the bottom and you can follow the direction it points very easily.
Solution 3:
When you create your first portal it will create a corresponding portal in the nether, and will ensure your portal doesn't dump you over magma. These portals are now linked (so when you come back through, you come out of your original portal).
It is possible to influence portal links when you start making additional portals, which can be confusing at first, but the way it works is that 1 block in the Nether spans 8 blocks in the main world. Creating additional portals will link to the closest portal in the other world if one is in range, or will create a new one.
There is an excellent guide to sorting out portal networks here which works great for getting portals to get you where you want to go. The compass unfortunately does not work in the Nether, but works anywhere in the main world.