Justification always depends on perspective. If the United States was justified in seeking new territory at the expense of another sovereign nation then one could view the invasion of Mexico as justified. There was perhaps the chance that even without the conflict Mexico would have been willing to cede the territory for a price, so perhaps a more peaceful solution could have been found. At the time any real negotiation was difficult because of conditions in Mexico City and constantly changing administrations and goals amidst all kinds of turmoil in the Mexican government.
There were many at the time who felt that the cost and the loss of life was not justified, but there were others who felt that it was simply the destiny of the United States to expand westward and so it was a matter of course that they would annex Texas and move towards taking California and other territories. This was nothing new as the United States had made a habit of taking territory they wanted and removing or buying off whomever was in control of it.