Obesity affects a large number of people around the world and appears to be the result of changes in food intake, eating habits and physical activity levels. Changes in dietary patterns and physical exercise are therefore strongly recommended to treat obesity and its complications. The present study tested the hypothesis that obesity and metabolic changes produced by a cafeteria diet can be prevented with dietary changes and/or physical exercise. A total of fifty-six female Wistar rats underwent one of five treatments: chow diet; cafeteria diet; cafeteria diet followed by a chow diet; cafeteria diet plus exercise; cafeteria diet followed by a chow diet plus exercise. The duration of the experiment was 34 weeks. The cafeteria diet resulted in higher energy intake, weight gain, increased visceral adipose tissue and liver weight, and insulin resistance. The cafeteria diet followed by the chow diet resulted in energy intake, body weight, visceral adipose tissue and liver weight and insulin sensitivity equal to that of the controls. Exercise increased total energy intake at week 34, but produced no changes in the animals' body weight or adipose tissue mass. However, insulin sensitivity in animals subjected to exercise and the diet was similar to that of the controls. The present study found that exposure to palatable food caused obesity and insulin resistance and a diet change was sufficient to prevent cafeteria diet-induced obesity and to maintain insulin sensitivity at normal levels. In addition, exercise resulted in normal insulin sensitivity in obese rats. These results may help to develop new approaches for the treatment of obesity and type 2 diabetes mellitus.