We model the retail market with dynamic pricing as a Stackelberg game where both retailers (leaders) and flexible consumers (followers) solve an economic cost-minimization problem. The electricity retailer optimizes an economic objective over a daily horizon by setting an hourly price-sequence, which is then communicated to the end-consumers. In turn, on the basis of such price sequence, consumers optimize a utility function that accounts both for energy procurement costs and for the benefit loss resulting from deferring consumption. The game is formulated as a Mathematical Problem with Equilibrium Constraints (MPEC) and cast as a Mixed Integer Linear Program (MILP), which can be solved using off-the-shelf optimization software. In an illustrative example, we consider a retailer associated with both flexible demand and wind power production. Such an example shows the efficiency of dynamic pricing as a way to control the load for minimizing the imbalances due to wind power, assesses the overall economic results for the retailer and the consumers as well as the dynamic properties of consumer flexibility.