From a normative perspective, the legitimacy of a political system is defined as the consistency with the ideal model. If you are a supporter of deliberative democracy, legitimacy means the political system conforms to the principles of deliberative democracy, i.e., it should be open, fair and reason-centered. However, when we ask the question why we should want deliberative democracy, one of the reasons the theorists offered is that it grants legitimacy to the decisions generated by such a system. Here, legitimacy becomes an empirical concept, which can be measured and may vary in degree.
From an empirical perspective, legitimacy is defined as an observable object that varies in degree. How to measure it often determines the way it is defined. If it is measured through self-reports of individuals, such as agreeing to be ruled, legitimacy is a perception of the rightness (worthiness in Habermasian term) of the political system. Then it does not distinguish between the different ideals individuals hold about the political system, whether the system should be a deliberative one or not. If it is measured by the performance of the political system, such as economic growth and national security, legitimacy is defined as consequences or effects. Many governments such as the ones in China and Singapore take advantage of this utilitarian approach to justify their ruling. The two ways of measurement are definitely intervened with each other. If the government can successfully persuade the ruled that legitimacy should build upon the effectiveness of governance, then we expect to see the perception of the rightness becomes a covariate of the performance of the political system.
What become really interesting, then, are the sources of the perceived legitimacy.