Age doesn't matter, but maturity and life stage does. In many cases, you have to have two people of similar age in order to have people who are in compatible stages in their life -- but not always. For instance, if you have one person who is in college who wants to spend time drinking and partying, they are not going to be a good match for the person who is ready to settle down and have kids -- or who might already have kids from a previous relationship.
Not everyone matches the average life stage for their age, and this is where age-gap relationships have a lot better chance of working. For instance, I met my husband in my early 20s. Unlike many people my age, I've never been a someone who likes to party or a casual dater, and I had a son from my first marriage. My husband was in his late 40s at the time, but unlike many men his age he loves small children and was willing to have another kid or two with me while helping me raise my son. Other men his age might not want the hassle of having a baby at that point in their lives (our daughter was born a couple months after his 51st birthday, his sixth and my second), and if that had been the case then he wouldn't have been a good match for me because I really wanted to have another kid. Likewise, if I had been wanting to drag him off to parties all the time or didn't want a serious relationship, then I would have been a bad match for him.
If you're interested, I have a couple of hubs on age-gap relationships, and trying to get a few more up, feel free to request hubs from me if there are other specific questions you'd like to see written about :).