According to the Dictionary of Marketing Terms, marketing is "the process of planning and executing the conception, pricing, promotion, and distribution of ideas, goods, and services to create exchanges that satisfy individual and organizational goals."
What does that mean to you? It means marketing encompasses everything you have to do in coming up with a needed product or service, making potential customers aware of it, making them want it, and then selling it to them.
So then, is sales considered "marketing"? Is advertising "marketing"? Often, you'll hear sales functions referred to as "marketing," but really sales is just a part of the larger marketing process, as is advertising. In the olden days (back 30 or 40 years), marketing did consist primarily of sales. Rather than having marketing departments, companies had sales departments with an advertising manager and someone who did market research. Sometimes they added a promotions manager or hired an agency to handle advertising and promotions.
Things began changing as some companies grew larger and larger and began offering many product lines that warranted having their own brand managers, market segment managers and many more specialized positions that addressed and mulled over the needs of their particular markets. The need for a marketing department began to be seen as a vital part of business. The marketing department also takes most of the blame if a product (or company) isn't successful, regardless of whether or not the fault actually lies there.