Contextual advertising systems place ads automatically in Web pages, based on the Web page content. In this paper we present a machine learning approach to contextual advertising using a novel set of features which aims to capture subtle semantic associations between the vocabularies of the ad and the Web page. We design a model for ranking ads with respect to a page which is learned using Support Vector Machines. We evaluate our model on a large set of manually evaluated ad placements. The proposed model significantly improves accuracy over a learned model using features from current work in contextual advertising.