Income tax powers for Wales set to come in 2019
Income tax rates in Wales could be varied from April 2019 as part of a deal with the UK Treasury.
In addition, the amount the Welsh Government can borrow for capital spending - funding for building and infrastructure - will double to £1bn.
Finance Secretary Mark Drakeford said agreement on the fiscal framework guaranteed "fair funding" for Wales.
Welsh Secretary Alun Cairns hailed the deal as a "significant milestone in the Welsh devolution journey".
It follows negotiations over how the Welsh budget will be adjusted to take account of the transfer of some responsibility for tax raising.
It is also responsible for business rates and council tax.
The income tax powers would allow ministers to cut or raise rates by 10p within each tax band, and will no longer require a referendum.
"I am pleased we have been able to reach agreement about a new fiscal framework which puts our funding on a stable and long-term footing," Mr Drakeford said, as the deal was announced on Monday.
"This is an agreement which is fair to Wales and the rest of the UK.
"It ensures fair funding for Wales for the long-term, something we have consistently made the case for and builds on the work of the Holtham Commission and the cross-party Silk Commission.
"This package of measures paves the way for partial income tax devolution in Wales.
"But crucially it protects our budget from the range of undue risks that could arise following the devolution of tax powers from 2018 and provides additional flexibility to manage our resources."
Analysis by Nick Servini, BBC Wales political editor
There have been groundhog day arguments for years about the perceived lack of adequate funding for the assembly from Westminster.
For some it has been a genuine grievance while for others it has created an "excuses culture" at Cardiff Bay.
Now it appears that particular battle is over, and the political debate at the assembly can at long last move on.
Tax devolution will give Welsh ministers powers over about 20% of the money they have available to spend on public services.
But most of their budget - currently around £15bn a year - will continue to come in an annual block grant from the Treasury.
Included in the details of the framework is a new way to calculate changes to that grant which is designed to reflect Wales' needs.
Those changes are determined by the Barnett formula. This framework does not scrap the formula, which the Welsh Government has said leaves it short-changed.
Instead, there will be new protections for the Welsh budget within the Barnett formula.
Mr Cairns said: "Agreement on the fiscal framework is a significant milestone in the Welsh devolution journey.
"It lies at the heart of the Wales Bill's determination to provide secure long-term funding for the Welsh Government and give Cardiff Bay greater visibility when looking at spending decisions."
The agreement on funding also paves the way towards the transfer of other powers, including over energy and water, included in the Wales Bill.
First Minister Carwyn Jones has said the assembly should not consent to the bill before an agreement on long-term funding.
Chief Secretary to the Treasury David Gauke said: "The path is now clear for the Welsh Assembly to consent to the implementation of the Wales Bill.
"We are delivering on our commitments and the Welsh Government can now decide how to use their greater powers and responsibilities to grow and support the Welsh economy."
Labour's Shadow Welsh Secretary Jo Stevens MP welcomed the deal as a "positive step forward" but claimed "serious questions remain unanswered by the Tory Government around funding for Wales post-Brexit".
Meanwhile Plaid Cymru's business spokesman Adam Price said the Welsh Government should be allowed to cut taxes without losing any Treasury grants.
"This agreement marks the moment when the focus in Welsh politics has to shift from funding to powers," he said.
"The Welsh Government must argue for a tax revolution, on the basis of an enlightened regional policy for Wales."