Moody's on Friday raised the debt rating of Portugal one notch to Ba1 and said it had a stable outlook, despite troubles at a major banking group.
Moody's cited the Portuguese government's "comfortable liquidity position, with regained access to the public debt markets and sizeable cash buffers" as a factor in making the upgrade.
The rating firm said it expected that the country's fiscal consolidation would remain on track despite unfavorable rulings by Portugal's constitutional court.
"This should support a gradual reduction in the very high public debt burden in the coming years," it said in a statement.
"The first driver behind the upgrade is Moody's view of the government's strong commitment to fiscal consolidation, despite repeated setbacks stemming from the adverse rulings of the country's constitutional court."
In May, Portugal's constitutional court rejected austerity measures included in Lisbon's 2014 budget as part of the center-right government's ongoing cutbacks, as it hopes to reduce its deficit to four percent of gross domestic product (GDP).
Portugal exited a three-year international bailout program in May, after receiving 78 billion euros ($106 billion) from the European Union and the International Monetary Fund in exchange for a series of stringent reforms.
Moody's noted that the government already has announced measures to "compensate" for the court's adverse rulings.
Moody's, which had lifted Portugal's rating by one notch in May, highlighted that the country's public debt ratio stands at around 120 percent of gross domestic product, "a very high debt burden that severely restricts" Portugal's room for fiscal maneuver.
"Moody's does not expect that the current uncertainties surrounding Banco Espirito Santo will have a material impact on the government's balance sheet," it added.
Banco Espirito Santo, the biggest in Portugal by capitalization, has been hit by suspicion that the bank's main holding company covered up a 1.3 billion euro ($1.7 billion) hole in the accounts
The crisis surrounding BES has renewed concern that Portugal's banks remain vulnerable after the country emerged from its bailout in May.