The use of game design elements to foster user engagement in non-game contexts, such as marketing, education, training, and healthcare, is rapidly gaining interest. Despite the growing attention given to gamification, little research has been conducted to theorize and empirical assess how and why game design elements influence user engagement. The resulting lack of an empirically validated theoretical foundation has kept the picture unclear of how gamification causes behavioral change in a way that increases user engagement. To help overcome the lack of theoretical support, this study develops a research model that predicts an individual's engagement by drawing on two theories - basic psychological needs theory and mechanic-dynamics-aesthetics theory. Findings from an empirical study with 275 subjects confirm the expectations of this research that game dynamics lead to increased needs satisfaction, which promotes enjoyment and, ultimately, user engagement with the system.