Recommender systems have become a crucial tool for electronic commerce. These systems help in improving customer satisfaction by providing personalized services. Much of the research in recommender systems is done in solving the top-N recommendation problem where the objective is to identify a set of N items the user will most likely prefer. In this paper, we propose a weighted class based hybrid algorithm to solve this problem. Our algorithm combines the strength of both content based and collaborative filtering approaches. In this method, firstly, classes are defined by applying content based and collaborative filtering techniques on ratings data. Subsequently, user's existing profile of items is examined to determine the weightage of each class. Items are then recommended to the user on the basis of weightage attached to each class. We show through experimental results that our algorithm consistently outperforms existing algorithms when applied on MovieLens data set.