Introduction: Considering that competitive advantage is the basis of strategic management, the purpose of this study is to determine the relationship between electronic human resource management, competitive advantage, and human resource flexibility. Methods: The present applied and descriptive research was done in the 2020. The statistical population of this research was the employees of the Isfahan government hospitals. Using Cochran formula, 341 people were taken as the final sample. The data collection tool in this study was a standard questionnaire whose validity and reliability had been confirmed in previous studies. The data were then analyzed by SPSS and LISREL software. Results: The results of the tests showed that electronic human resource management with 0/76 impact factor had a positive and significant effect on the competitive advantage, and the one with 0/66 impact factor had a positive and significant effect on flexibility of human resources. Also, human resource flexibility with 0/35 impact factor had a positive and significant impact on competitive advantage. Conclusion: Considering the mediating role of the human resources flexibility in the relationship between electronic human resources with competitive advantage, we need to invest in the electronic system related sectors to improve strategic decision-making procedures in the field of appropriate investment in human resources and increased competitive advantage.