Following the Meiji restoration, the former "daimyō" - the landed nobility of Japan - were merged with the "kuge" - the aristocratic families that held positions in the Imperial Court - to form a class known as the "kazoku." Many members of the kazoku were appointed to positions in the new Meiji government (which initially ruled through the Great Council, or Daijō-kan, of the Imperial Court, before that was replaced by a Cabinet in 1885).
In 1884, the kazoku was formally divided into five ranks:
公爵 - Kōshaku = Prince/Duke
侯爵 - Kōshaku (note the different kanji than the above rank) = Marquis
伯爵 - Hakushaku = Count
子爵 - Shishaku = Viscount
男爵 - Danshaku = Baron
The ranks are inspired by British nobility, whilst the titles were based on ancient Chinese ranks.
The heirs to the houses that made up the kuge were ranked as either princes or marquis, based on whether their houses had held the title of regent (technically, "sesshō & kampaku") or not in the past. Heirs to those that did became princes, heirs those that didn't became marquis.
The Meiji Restoration was largely the work of men from the Chōshū and Satsuma domains, and as such the ruling daimyō of those domains became princes as well. The former Tokugawa shōgun was also allowed the rank of prince and the "shinpan" - houses that had branched off of the Tokugawa - heirs became marquis. Remaining daimyō heirs were given ranks from marquis to baron based on the agricultural output of their land.
Prior to the Restoration, these daimyō had controlled domains known as "han," (two examples being the aforementioned Satsuma and Chōshū han) but in 1871 this system had been phased out. Domains were turned into prefectures, and daimyō (or, well, kazoku, as the title of daimyō was phased out as well) became non-heriditary governors. The kazoku system ensured the continued political importance of these landed families, albeit at a reduced level. They still got a better deal than the samurai, who were organized into a new class called the shizoku, which retained few of the rights they once possessed.
In 1889, the first Japanese Constitution was approved by the Emperor, and it entered into force in 1890. Among other things, it created a legislature, the Imperial Diet, consisting of a House of Peers and a House of Representatives. The House of Peers was the upper house, and was modeled after the Prussian House of Lords, as German advisors had assisted in drafting the constitution.
Here are the relevant articles of the Meiji Constitution:
Article 33. The Imperial Diet shall consist of two Houses, a House of Peers and a House of Representatives.
Article 34. The House of Peers shall, in accordance with the ordinance concerning the House of Peers, be composed of the members of the Imperial Family, of the orders of nobility, and of those who have been nominated thereto by the Emperor.
Article 35. The House of Representatives shall be composed of members elected by the people, according to the provisions of the law of Election.
Princes and marquis were members of he House of Peers in their own right, whilst counts, viscounts, and barons elected representatives from amongst their own ranks to sit in the House. Members of the Imperial family and individuals appointed by the Emperor formed the rest of the House of Peers.
The Meiji Constitution was replaced by the current Japanese Constitution in 1947. In this Constitution, the role of the upper house in the Diet was taken by the democratically elected House of Councillors. This ended the political role of the peerage. The kazoku class and the various ranks also ceased to exist.
Sources: Wikipedia, A Modern History of Japan: From Tokugawa Times to the Present, and the Meiji Constitution.
Just to add to earlier comments, some peers were imperial appointees, appointed to the house of peers by the emperor (i.e., prime minister) for merit (similar to Britain's House of Lords). Other peers were the highest tax-payers of their prefecture and got their seat that way.
So just remember that being a member of the Japanese peerage was not always the same thing as being a member of the Japanese House of Peers. There were lots of barons, viscounts, and counts who did not serve in the Diet. There were many untitled peers serving in the House of Peers. There were also many untitled sons, daughters, nieces, and nephews of peers who were also considered part of the nobility. For example, Prince Chichibu, Emperor Showa's brother, married the niece of Viscount Matsudaira. She was technically not a peer since her father did not hold the viscountcy. But she was considered "good enough" to marry into the imperial family. Though I believe she had to be "adopted" by her uncle right before marriage.
And let's not forget that dozens of Korean and Okinawan nobility/royalty held Japanese peerage titles, although almost nothing is known about them. Some elites in Manchukuo may have been made peers, but I don't know for sure.
The peerage technically went out of existence in 1947, when the new constitution went into effect. But descendants of the peerage still retain a subtle cachet and prestige in postwar Japan. Many of the high priests at Japan's most important shrines, for instance, come from the former peerage, as many of the palace courtiers. All of the children of Emperor Showa except his eldest son married descendants of the peerage family after World War II. Many postwar prime ministers were also descended from the peerage - Aso Taro, Hatoyama Yukio, Hosokawa Morihiro, etc.
Yes, they did. The Meiji restoration created a system of aristocracy which was not tied to any geographical holdings (unlike in the feudal system which existed prior). There were five ranks of nobility based on the British peerage system, but with titles based on the Chinese system of nobility. The post-war Japanese constitution dissolved the nobility with the exception of inside the imperial family.