Ago measures a length of time into the past from now (the present).
At ten o'clock, an hour ago was nine o'clock.
A year ago is (approximately) 365 days previously.
In quoted speech ago is used to refer to a length of time prior to the speech: In 2010 he said, "I gave up smoking three years ago."
Before marks a period prior to a particular point/day/year in history or an event/period.
Before means prior to/earlier than a time/date or an event.
Unlike ago, before does not usually relate to now
Before can refer to the past (*before he died) or to the future (before she arrives). It is always tied to a particular time or event.