This paper presents a comprehensive techno-economic analysis of the world's first large-scale commercial Power-to-X (PtX) plant in Kassø, Denmark. This innovative facility combines solar photovoltaic (PV), an electrical grid, green hydrogen production, methanol synthesis, and district heating in an integrated system. We conduct an in-depth analysis to explore optimal operating conditions, the potential for sector coupling within the power and heat sectors, and the economic feasibility of the integrated system. In particular, we study different scenarios considering changes in solar PV power generation, electricity market price, CO2 price, and methanol price to explore their impacts on the system performance. Our results show that the electrolyzer's operation, a pivotal component of the system, heavily depends on the electricity spot price as well as the methanol price. Based on the green production of methanol, a premium price of 4800 DKK/t (0.64 €/t) is considered in this study (selling price of 8400 DKK/t). The results show that in case of high electricity prices (2022 spot market) or no premium price for methanol, the optimum annual production of methanol decreases by 58% and 67%, respectively. Furthermore, we observe that the variability of solar power output significantly impacts the plant's performance and economic viability, as it supplies about 30% of the plant's power consumption. Although the results are unique to the Kassø plant, the study's techniques and insights can be applied to other comparable systems around the world. The study also highlights how crucial it is to take market, climate, and technical factors into account when developing and running integrated energy systems.