We present a new average-based robustness for Signal Temporal Logic (STL) and a framework for optimal control of a dynamical system under STL constraints. By averaging the scores of different specifications or subformulae at different time points, our definition highlights the frequency of satisfaction as well as how robustly each specification is satisfied. Its usefulness in control synthesis problems is illustrated through case studies.